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

Error: Cannot find module 'fs-extra' #61

Closed
jonahsnider opened this issue Jun 7, 2020 · 1 comment · Fixed by #62
Closed

Error: Cannot find module 'fs-extra' #61

jonahsnider opened this issue Jun 7, 2020 · 1 comment · Fixed by #62

Comments

@jonahsnider
Copy link
Contributor

fs-extra is used by next-pwa but not actually in the dependencies. This makes the library totally unusable for anyone using

  • A package manager that uses PnP
  • Yarn 2
  • Anyone who isn't coincidentally installing a package that properly depends on fs-extra
$ next build

> Build error occurred
Error: Cannot find module 'fs-extra'
Require stack:
- /usr/src/project/node_modules/next-pwa/index.js
- /usr/src/project/next.config.js
- /usr/src/project/node_modules/next/dist/next-server/server/config.js
- /usr/src/project/node_modules/next/dist/build/index.js
- /usr/src/project/node_modules/next/dist/cli/next-build.js
- /usr/src/project/node_modules/next/dist/bin/next
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/src/project/node_modules/next-pwa/index.js:4:12)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/src/project/node_modules/next-pwa/index.js',
    '/usr/src/project/next.config.js',
    '/usr/src/project/node_modules/next/dist/next-server/server/config.js',
    '/usr/src/project/node_modules/next/dist/build/index.js',
    '/usr/src/project/node_modules/next/dist/cli/next-build.js',
    '/usr/src/project/node_modules/next/dist/bin/next'
  ]
}
@jonahsnider
Copy link
Contributor Author

Looking at the source code, the fs-extra package is only used once for something that's in the base fs module.

if (fs.existsSync(customWorkerEntry)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant