child-process-promise icon indicating copy to clipboard operation
child-process-promise copied to clipboard

`fs` and `child_process` not found

Open paddotk opened this issue 4 years ago • 2 comments

I've successfully installed the package. When I try to run my app with an import of exec from the package, npm fails to build because it cannot find fs and child_process.

The app is an Angular one and I'm trying to import the package in the main.ts file in the root of the project.

The exact errors:

ERROR in ./node_modules/child-process-promise/lib/index.js
Module not found: Error: Can't resolve 'child_process' in 'my_project\node_modules\child-process-promise\lib'
ERROR in ./node_modules/child-process-promise/lib-es5/index.js
Module not found: Error: Can't resolve 'child_process' in 'my_project\node_modules\child-process-promise\lib-es5'
ERROR in ./node_modules/child-process-promise/node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'child_process' in 'my_project\node_modules\child-process-promise\node_modules\cross-spawn'
ERROR in ./node_modules/child-process-promise/node_modules/cross-spawn/lib/parse.js
Module not found: Error: Can't resolve 'fs' in 'my_project\node_modules\child-process-promise\node_modules\cross-spawn\lib'
ERROR in ./node_modules/isexe/index.js
Module not found: Error: Can't resolve 'fs' in 'my_project\node_modules\isexe'
ERROR in ./node_modules/isexe/mode.js
Module not found: Error: Can't resolve 'fs' in 'my_project\node_modules\isexe'
ERROR in ./node_modules/isexe/windows.js
Module not found: Error: Can't resolve 'fs' in 'my_project\node_modules\isexe' 

paddotk avatar Jun 16 '20 10:06 paddotk

You do not need to install them. They are built into node.

BumpyBill avatar Oct 01 '20 07:10 BumpyBill

child_process comes from the node environment. Normally Angular is using webpack and targeting browser clients and it can not be used. Not sure what's the use case you have.

sonu-drip avatar Jan 12 '24 07:01 sonu-drip