10
votes

I am trying to setup existing nodejs project on my window

Npm -v :- 6.0.1
node -v :- v8.11.1

When i run node app.js i am getting following error

include-all attempted to require(C:\xampp\htdocs\sails\backend\api\services\FileUploadService.js)`, but an error occurred:: Details:Error: Cannot find module 'internal/util/types' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at evalmachine.:31:26 at Object. (C:\xampp\htdocs\sails\backend\node_modules\s3\node_modules\graceful-fs\fs.js:11:1) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (C:\xampp\htdocs\sails\backend\node_modules\s3\node_modules\graceful-fs\graceful-fs.js:3:27) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (C:\xampp\htdocs\sails\backend\node_modules\s3\lib\index.js:3:10)

Any idea? what i am missing

3

3 Answers

4
votes

I had same issue. After researching it, it looks like there are many ways that people have fix this problem.

What caused the problem for me was that I upgraded node and needed to rebuild my project.

npm rebuild

Fixed it for me.

There is a lengthy discussion here: nodemon

2
votes

Reverting to an earlier version, resolved the crash I was getting each time I run npm :

sudo n 6.12.0

Thanks to: https://github.com/remy/nodemon/issues/1124#issuecomment-345181229

1
votes

In Windows 10 I recently had error message also, running nodejs. This error would occur even if I simply ran something simple like npm --version.

I then noticed the error stack trace showed the following script in the call stack:

C:\Users\\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)

It turns out that an earlier version of npm had installed scripts in the user's profile folder and, for some reason, that never got removed - even though I had performed many uninstalls and reinstalls of the latest nodejs version.

Simply removing the entire npm folder under C:\Users\<myusername>\AppData\Roaming\npm solved the issue.

The latest npm installs these scripts in C:\Program Files\nodejs\node_modules\npm, which is where these should be picked up.