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: Can't resolve 'child_process' in 'node_modules/worker-farm/lib'` #9263

Closed
Alaboudi1 opened this issue Oct 31, 2019 · 6 comments
Closed
Labels
please add a complete reproduction The issue lacks information for further investigation

Comments

@Alaboudi1
Copy link

Bug report

Describe the bug

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.

To Reproduce

I do not know how to reproduce as it happens all unexpectedly.

Expected behavior

To work as it did before, just render the page!

Screenshots

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

System information

I am using gitpod.io

Additional context

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"
  }
}
@Alaboudi1 Alaboudi1 changed the title Error: Can't resolve 'child_process' in '/workspace/observe.dev/node_modules/worker-farm/lib'` Error: Can't resolve 'child_process' in 'node_modules/worker-farm/lib'` Oct 31, 2019
@timneutkens
Copy link
Member

timneutkens commented Oct 31, 2019

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.

@timneutkens timneutkens added the please add a complete reproduction The issue lacks information for further investigation label Oct 31, 2019
@Alaboudi1
Copy link
Author

Alaboudi1 commented Oct 31, 2019

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.

image

image

And then the error happens!

image

@Alaboudi1
Copy link
Author

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.

@x5engine
Copy link

@Alaboudi1 ramadan karim ;)

@omer-mizrahi
Copy link

thank you :)

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
please add a complete reproduction The issue lacks information for further investigation
Projects
None yet
Development

No branches or pull requests

5 participants