I have an application with three pages. The app works fine but when I access the third page, I get an error with Module not found: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'
The bug showed up even with no change in the source code from my part! I have tried a clean install but did not work.
I do not know how to reproduce as it happens all unexpectedly.
To work as it did before, just render the page!
yarn run v1.17.3
$ next
[ wait ] starting the development server ...
[ info ] waiting on http://localhost:3000 ...
[ info ] bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:3000
[ wait ] compiling ...
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
[ info ] bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:3000
[ event ] build page: /
[ wait ] compiling ...
[ info ] bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:3000
Warning: Unsupported style property padding-top. Did you mean paddingTop?
in button (at fileUpload.js:32)
in Link (at fileUpload.js:31)
in div (at fileUpload.js:20)
in FileUpload (at main.js:34)
in div (at main.js:14)
in div (at main.js:13)
in div (at main.js:12)
in Main (at pages/index.js:6)
in div (at layouts.js:3)
in Unknown (at pages/index.js:5)
in div (at pages/index.js:4)
in Index
in App
in Context.Provider
in Context.Provider
in Context.Provider
in Context.Provider
in AppContainer
[ event ] build page: /dataset/[sheetId]
[ wait ] compiling ...
[ info ] bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:3000
[ event ] build page: /video/[sheetId]/[videoId]
[ wait ] compiling ...
[ error ] ./node_modules/worker-farm/lib/fork.js
Module not found: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'
ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'
at factory.create (/workspace/observe.dev/node_modules/webpack/lib/Compilation.js:888:10)
at factory (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
at resolver (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
at asyncLib.parallel (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
at /workspace/observe.dev/node_modules/neo-async/async.js:2830:7
at /workspace/observe.dev/node_modules/neo-async/async.js:6877:13
at normalResolver.resolve (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
at doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:184:12)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at resolver.doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at resolver.doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
[ event ] build page: /next/dist/pages/_error
[ wait ] compiling ...
[ error ] ./node_modules/worker-farm/lib/fork.js
Module not found: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'
ModuleNotFoundError: Module not found: Error: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'
at factory.create (/workspace/observe.dev/node_modules/webpack/lib/Compilation.js:888:10)
at factory (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:401:22)
at resolver (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:130:21)
at asyncLib.parallel (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:224:22)
at /workspace/observe.dev/node_modules/neo-async/async.js:2830:7
at /workspace/observe.dev/node_modules/neo-async/async.js:6877:13
at normalResolver.resolve (/workspace/observe.dev/node_modules/webpack/lib/NormalModuleFactory.js:214:25)
at doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:184:12)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at resolver.doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:37:5)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
at hook.callAsync (/workspace/observe.dev/node_modules/enhanced-resolve/lib/Resolver.js:238:5)
at _fn0 (eval at create (/workspace/observe.dev/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
at resolver.doResolve (/workspace/observe.dev/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:38)
[ event ] client pings, but there's no entry for page: /_error
I am using gitpod.io
package.json
{
"name": "observe.dev",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start",
"export": "next export"
},
"repository": {
"type": "git",
"url": "git+https://github.com/devuxd/observe.dev.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/devuxd/observe.dev/issues"
},
"homepage": "https://github.com/devuxd/observe.dev#readme",
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.19",
"@fortawesome/free-solid-svg-icons": "^5.9.0",
"@fortawesome/react-fontawesome": "^0.1.4",
"@zeit/next-css": "1.0.1",
"d3": "^5.9.7",
"d3-scale-chromatic": "^1.3.3",
"moment": "^2.24.0",
"next": "^9.1.2",
"now": "^16.3.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"react-player": "^1.13.0",
"react-tabs": "^3.0.0"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"devDependencies": {
"@types/next": "^8.0.5",
"@types/node": "^12.0.2",
"@types/react": "^16.8.18",
"@types/react-dom": "^16.8.4",
"cross-env": "^5.2.0",
"css-loader": "^3.0.0",
"husky": "^2.3.0",
"prettier": "^1.17.1",
"pretty-quick": "^1.11.0",
"style-loader": "^0.23.1",
"typescript": "^3.5.3"
}
}
It's not possible to reproduce this issue without a clear and concise reproduction as asked for in the issue template. Please provide one so that we can have a look.
Hi, thanks for the prompt response! here is the source code I am working on
https://github.com/Alaboudi1/observe.dev
https://codesandbox.io/s/github/Alaboudi1/observe.dev/tree/master/?fontsize=14
just install it and then run the app, open localhost:3000 and then navigate as follows.


And then the error happens!

Alright, I found the cause of this error. It is the auto import in VS code. It auto imported import { debug } from "webpack"; when I inserted a debug statement, which causes this supper confusing error message.
@Alaboudi1 ramadan karim ;)
Most helpful comment
Alright, I found the cause of this error. It is the auto import in VS code. It auto imported
import { debug } from "webpack";when I inserted a debug statement, which causes this supper confusing error message.