Gatsby: "[email protected]" is exporting a variable named "onPostPrefetc hPathname" which isn't an API

Created on 16 Oct 2018  路  8Comments  路  Source: gatsbyjs/gatsby

I am following the tutorial to add offline support https://www.gatsbyjs.org/tutorial/part-eight/#add-offline-support

While building site using gatsby build I am getting below error. As mentioned in error, there is no exported method called "onPostPrefetchPathname" in browser-apis. may be this was renamed in version 2.0

Your plugins must export known APIs from their gatsby-browser.js.The following exports aren't APIs. Perhaps you made a typo or your plugin is outdated?

See https://www.gatsbyjs.org/docs/browser-apis/ for the list of Gatsby Browser APIs

- The plugin "[email protected]" is exporting a variable named "onPostPrefetc
hPathname" which isn't an API.

Perhaps you meant to export "onPrefetchPathname"?

Below is the environment info

System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.11.0 - ~/.nvm/versions/node/v10.11.0/bin/node
    npm: 6.4.1 - ~/.nvm/versions/node/v10.11.0/bin/npm  Browsers:
    Chrome: 69.0.3497.100
    Firefox: 61.0.1
    Safari: 12.0
  npmPackages:
    gatsby: ^2.0.0 => 2.0.0
    gatsby-plugin-emotion: ^2.0.5 => 2.0.5
    gatsby-plugin-manifest: ^2.0.5 => 2.0.5
    gatsby-plugin-offline: ^2.0.6 => 2.0.6
    gatsby-plugin-react-helmet: ^3.0.0 => 3.0.0
    gatsby-plugin-typography: ^2.2.0 => 2.2.0
    gatsby-source-filesystem: ^2.0.3 => 2.0.3
    gatsby-transformer-remark: ^2.1.7 => 2.1.7

Most helpful comment

Problem still exists with gatsby v2.4.3

All 8 comments

I have exactly the same, i just wanted to post the issue.

Please update gatsby version, it should fix it

Updated to latest (2.0.24) in this PR

Still have this very same issue after updating.
My infos:

System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i7-3635QM CPU @ 2.40GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.10.0 - /usr/local/bin/node
    npm: 6.4.1 - ~/.npm-packages/bin/npm
  Browsers:
    Chrome: 69.0.3497.100
    Safari: 12.0
  npmPackages:
    gatsby: next => 2.0.0-rc.28
    gatsby-image: ^1.0.55 => 1.0.55
    gatsby-plugin-manifest: ^2.0.5 => 2.0.5
    gatsby-plugin-offline: ^2.0.6 => 2.0.6
    gatsby-plugin-react-helmet: next => 3.0.0-rc.1
    gatsby-plugin-sharp: ^1.6.48 => 1.6.48
    gatsby-source-wordpress: ^3.0.6 => 3.0.6
    gatsby-transformer-sharp: ^1.6.27 => 1.6.27
  npmGlobalPackages:
    gatsby-cli: 1.1.58

Ok, next was the problem, it's stuck at rc version, I used latest instead. Did the trick.

offline plugin should report of there is missmatching gatsby version thanks to @GuyKh PR #9150 , so I'm closing this issue

Problem still exists with gatsby v2.4.3

Had the same issue, so I've just monkeypatched node_modules/gatsby-plugin-offline/gatsby-browser.js like suggested in prompt, from this:

exports.onPostPrefetchPathname = function (_ref) { ... }

to this:

exports.onPrefetchPathname = function (_ref) { ... }

and the app has built

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mikestopcontinues picture mikestopcontinues  路  3Comments

hobochild picture hobochild  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

andykais picture andykais  路  3Comments

ghost picture ghost  路  3Comments