Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3-beta Error: Cannot find module 'walk' #1971

Closed
johhansantana opened this issue May 15, 2017 · 6 comments
Closed

v3-beta Error: Cannot find module 'walk' #1971

johhansantana opened this issue May 15, 2017 · 6 comments

Comments

@johhansantana
Copy link
Contributor

when I do next build && next export I get an error:

➜  with-dynamic-import git:(v3-beta) ✗ yarn build
yarn build v0.21.3
$ next build && next export 
> Using external babel configuration
> location: "/Users/jsantana/Downloads/next.js/examples/.babelrc"
module.js:472
    throw err;
    ^

Error: Cannot find module 'walk'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/jsantana/Downloads/next.js/examples/with-dynamic-import/node_modules/next/dist/server/export.js:39:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
error Command failed with exit code 1.
@arunoda
Copy link
Contributor

arunoda commented May 15, 2017

Thanks.
Try the latest beta. We just fixed it.

@arunoda arunoda closed this as completed May 15, 2017
@johhansantana
Copy link
Contributor Author

@arunoda the blog post with the example next.config.js has invalid syntax

exports.exportPathMap = () => {
  "/": { page: "/" },
  "/about": { page: "/about" },
  "/p/hello-nextjs": { page: "/post", query: { title: "hello-nextjs" } },
  "/p/learn-nextjs": { page: "/post", query: { title: "learn-nextjs" } },
  "/p/deploy-nextjs": { page: "/post", query: { title: "deploy-nextjs" } }
}

if I try to change it to

exports.exportPathMap = {
  "/": { page: "/" },
  "/about": { page: "/about" },
  "/p/hello-nextjs": { page: "/post", query: { title: "hello-nextjs" } },
  "/p/learn-nextjs": { page: "/post", query: { title: "learn-nextjs" } },
  "/p/deploy-nextjs": { page: "/post", query: { title: "deploy-nextjs" } }
}

The next export gives me error:

$ next export 
  Exporting to: /Users/jsantana/Downloads/next.js/examples/with-dynamic-import/out

  copying dynamic import chunks
> Could not found "exportPathMap" function inside "next.config.js"
> "next export" uses that function build html pages.
error Command failed with exit code 1.

@johhansantana
Copy link
Contributor Author

fixed:

exports.exportPathMap = () => {
  return {
    "/": { page: "/" },
    "/about": { page: "/about" }
  }
}

@arunoda
Copy link
Contributor

arunoda commented May 16, 2017

Thanks. Will fix it.

@wasim-ullah
Copy link

Is it fixed? I still can see the same issue.

@tianhuil
Copy link

tianhuil commented Feb 4, 2018

@mrwullah, this issue has been fixed. You have to fill in next.config.js as per @johhansantana's latest comment and the error goes away.

@lock lock bot locked as resolved and limited conversation to collaborators Feb 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants