nodemon: Error: Cannot find module 'internal/util/types'

This is what I get when running nodemon with no arguments.

exception in nodemon killing node
Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:513:15)
    at Function.Module._load (module.js:463:25)
    at Module.require (module.js:556:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (/usr/local/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)

I’m using node 8.8.1

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 23
  • Comments: 63 (4 by maintainers)

Commits related to this issue

Most upvoted comments

I have solved it in this way:

sudo npm cache clean
sudo n 6.12.0
sudo npm uninstall npm -g
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
//if you are using a raspberry with node-red installed run this command to reinstall npm and node
update-nodejs-and-nodered 
//OR run this command to reinstall manually
sudo apt install nodejs npm

i had this issue in my Win8.1 box; was going from npm@3.10.3 and node@v6.4.0 to npm@5.5.1 and node@v8.9.3

solved it by these steps: delete C:\Users\<user>\AppData\Roaming\npm\node_modules\npm run npm install -g npm

I think it is realated to: https://github.com/npm/npm/issues/19032 and it is closed. For me this helped.

On Windows, this is how it sorted out:

  1. Go to <node dir>\global_modules\node_modules,

  2. Delete the “npm” folder and all its contents,

  3. Go to https://nodejs.org,

  4. Download the “Recommended For Most Users” version (currently 8.9.1 LTS),

  5. Install it

This worked for me on Win7.

I had this issue, I fixed it by dropping down my node version (to 6.2.2 in my case), updating npm, and then going back to Node v9.0.0.

I solved this by reinstalling bower. And running bower install

Using n for version management. What fixed it for me:

curl -0 -L https://npmjs.com/install.sh | sudo sh
sudo npm cache clean

removing C:\Users{YOUR USERNAME}\AppData\Roaming\npm solve it for me

Ubuntu 17.04 Node v8.9.1

This was occurring to me when i tried to run my gulp scripts. I did few things, not really sure which one in particular solved it, but this is what i did:

sudo npm cache clean --force
sudo npm i -g npm

Then i deleted my node_modules in my project and after the npm i everything worked.

Okay, so what I did to fix my issue is, uninstalled my ionic-cli and installed the latest version. That fixed the issues. Do note that in latest version of ionic, commands execute with ionic cordova instead of ionic only, with exception of ionic serve.

npm uninstall -g ionic-cli
npm install -g ionic@latest

I had the same issue. When i reverted to the older version of node js,the problem got solved.

I was able to solve this issue for me by deleting package-lock.json and rebuilding the node modules for my project.

For those who’re facing this issue on ionic projects after updating to Mac Sierra 10.13, know that the problem is with ionic CLI (v1.7.16). I was facing issue while creating builds using the normal ionic command ionic build android and I was getting

Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:542:15)
    at Function.Module._load (module.js:472:25)
    at Module.require (module.js:585:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)

Cannot find module 'internal/util/types' (CLI v1.7.16)

The solution is, instead of using ionic commands, use the cordova commands directly, like, cordova build android Hope that helps someone.

Hello, why don’t you try:

rm -rf node_modules
npm install

Closing. This seems to be related to cached node_modules between version changes.

I fixed it like this (Windows): It turned out I had an old version of npm.exe in C:\ProgramData\chocolatey\bin Just run npm.exe install -g npm and it fixed it

On OSX High Sierra / Brew Installed, similar to @artemv and others:

brew uninstall nodejs
sudo rm -rdf cd /usr/local/lib/node_modules/
brew install nodejs

on windows 7, i fixed the problem by going to C:\Users\my.username\AppData\Roaming\npm and deleting the node_modules folder. afterwards i could run “npm install” without problems.

using

node v9.8.0 npm v3.5.3

Having the same issue on windows 8.1 with node 8.9.1 and 9.2.0. Downgrading to node 6.12 solves the problem. Complete uninstall/installs don’t. How can possibly a stable node version be released like that?

Ah looks like node v8.2.1 works.

I started to have this issue after another upgrade of Node (from 8.5.6 to 8.10.0 in my case) with n. Following fixed it for me (needs yarn to be installed):

rm -rf /usr/local/lib/node_modules/npm
yarn global add npm@5.6.0 #put your desired version of npm here

@eternalsayed same problem here, same workaround!

Could you resolve how to do ionic serve?

@wema1043

node version : v8.9.0 npm : 5.5.1

After upgrade to OS X 10.13.1 it started failing.

brew upgrade node - fixed the issue