Cannot find module 'internal/util/types'

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.


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


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