Webpack Integration - 'Cannot resolve module 'child_process'
See original GitHub issueI’m trying to use cytoscape.js with webpack and am having trouble including it. I’ve tried both:
var cytoscape = require('cytoscape');
and
import cytoscape from 'cytoscape'
In both cases, running ‘webpack’ creates the errors:
WARNING in ./~/cytoscape/dist/cytoscape.js
Critical dependencies:
563:63-70 require function is used in a way in which dependencies cannot be statically extracted
577:59-66 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/cytoscape/dist/cytoscape.js 563:63-70 577:59-66
WARNING in ./~/cytoscape/dist/cytoscape.js
Critical dependencies:
564:16-31 the request of a dependency is an expression
578:10-583:12 the request of a dependency is an expression
@ ./~/cytoscape/dist/cytoscape.js 564:16-31 578:10-583:12
WARNING in ./~/cytoscape/dist/cytoscape.min.js
Critical dependencies:
18:1282-1289 require function is used in a way in which dependencies cannot be statically extracted
18:1157-1164 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/cytoscape/dist/cytoscape.min.js 18:1282-1289 18:1157-1164
WARNING in ./~/cytoscape/dist/cytoscape.min.js
Critical dependencies:
18:1169-1179 the request of a dependency is an expression
18:1291-1344 the request of a dependency is an expression
@ ./~/cytoscape/dist/cytoscape.min.js 18:1169-1179 18:1291-1344
ERROR in ./~/cytoscape/dist/cytoscape.js
Module not found: Error: Cannot resolve module 'child_process' in /home/ozzie/personal/test/node_modules/cytoscape/dist
@ ./~/cytoscape/dist/cytoscape.js 7170:30-54
ERROR in ./~/cytoscape/dist/cytoscape.min.js
Module not found: Error: Cannot resolve module 'child_process' in /home/ozzie/personal/test/node_modules/cytoscape/dist
@ ./~/cytoscape/dist/cytoscape.min.js 21:10865-10889
Very similar issues have been documented in other npm packages: https://github.com/ParsePlatform/ParseReact/issues/11 https://github.com/webpack/webpack-dev-server/issues/66
Issue Analytics
- State:
- Created 8 years ago
- Reactions:5
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Module not found: Error can't resolve 'child_process', how to fix?
just put in package.json "browser":{ "child_process": false }. are you using webpack.
Read more >Resolve | webpack
Configure how modules are resolved. For example, when calling import 'lodash' in ES2015, the resolve options can change where webpack goes to look...
Read more >webpack cant resolve fs | The AI Search Engine You Control
No matter what I try, I always get the "Cannot find module 'fs'" error. Does anyone have an idea of what this could...
Read more >Cannot resolve module 'child_process' in node.d.ts-Reactjs
[Solved]-Webpack and TypeScript: Cannot resolve module 'child_process' in node.d.ts-Reactjs ... All you're missing is a key target: 'node' . This makes sure that ......
Read more >ts-node - npm
Tip: Installing modules locally allows you to control and share the versions through package.json . ts-node will always resolve the compiler ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was able to get around this by doing,
Of course, this doesn’t seem like the best fix.
I am facing above error when I build my react application. My application is created using create-react-app and electronjs. I googled for this issue and the most suggested solutions are related to webpack config which I can not directly modify in create-react-app. I tried those solutions like adding ‘target: node’ and external config etc by ejecting create react app but that also did not work. Before adding serialport package it was working properly now it looks up for the child_process package into serialport libs. Can someone help me out in this?