remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.32k stars 1.73k forks source link

Error: Cannot find module 'internal/util/types' #1124

Closed magician11 closed 6 years ago

magician11 commented 7 years ago

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

magician11 commented 7 years ago

Ah looks like node v8.2.1 works.

akila5893 commented 7 years ago

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

cerniuk commented 7 years ago

Still happening in v8.9.0.

npm ERR! Cannot find module 'internal/util/types'

Although nodejs seemed to install without errors.

ImTheDeveloper commented 7 years ago

I've dropped down to v8.2.1 and still hit the same issues:

xxx@xxx~/Programs/xxx.telegram.bot$ nvm alias default 8.2.1
default -> 8.2.1 (-> v8.2.1)
xxx@xxx:~/Programs/xxx.telegram.bot$ cd /home/munkee/Programs/xxx.telegram.bot ; env "NODE_ENV=development" /usr/bin/nodemon --inspect=13845 --debug-brk index.js
exception in nodemon killing node
Error: Cannot find module 'internal/fs'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:40:20
    at Object.<anonymous> (/usr/lib/node_modules/nodemon/node_modules/update-notifier/node_modules/configstore/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)

----------------------------------------------------------
If appropriate, please file an error with the output from:
$ /home/munkee/.nvm/versions/node/v8.2.1/bin/node /usr/bin/nodemon --inspect=13845 --debug-brk index.js --dump
At http://github.com/remy/nodemon/issues/new
----------------------------------------------------------
gurtajkhatra commented 7 years ago

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.

ImTheDeveloper commented 7 years ago

I'm using nvm I'm wondering if I need to clear out remove something after dropping down the versions of node to then run the npm update. I've tried just dropping and running the update but I still get the same error.

ifredom commented 7 years ago

I found the cause of the problem.This problem occurs if the default path of the command line is set in the registry again

ImTheDeveloper commented 7 years ago

How do you fix that? 😂 I'm using ubuntu fwiw

On Thu, 9 Nov 2017, 08:07 ifredom, notifications@github.com wrote:

I found the cause of the problem.This problem occurs if the default path of the command line is set in the registry again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/remy/nodemon/issues/1124#issuecomment-343077326, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXXNFH2xvmsCGSeWjZ-asdA5ndnQe1Vks5s0rLNgaJpZM4QLuLN .

moritzpflaum commented 7 years ago

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

vdrasutis commented 7 years ago

Same for v8.9.1, when trying to install angular CLI:

D:\playground\ng>npm install -g @angular/cli@latest npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "@angular/cli@latest" npm ERR! node v8.9.1 npm ERR! npm v3.7.1 npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module 'internal/util/types' npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! D:\playground\ng\npm-debug.log

vdrasutis commented 7 years ago

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

aromot commented 7 years ago

On Windows, this is how it sorted out:

  1. Go to \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.

ImTheDeveloper commented 7 years ago

Anyone have instructions for Ubuntu. I would assume same deal remove node modules and start over?👊👍

On Sun, 12 Nov 2017, 17:22 aromot, notifications@github.com wrote:

On Windows, this is how it sorted out:

1.

Go to \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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/remy/nodemon/issues/1124#issuecomment-343752571, or mute the thread https://github.com/notifications/unsubscribe-auth/ABXXNP9XRxVSsmFaapv8aZ4kTUeRBsg5ks5s1ylegaJpZM4QLuLN .

mmilenkovic commented 6 years ago

After upgrade to OS X 10.13.1 it started failing.

brew upgrade node - fixed the issue

johnsonsamuel commented 6 years ago

I am having the same issue on Mac. My tests are failing.

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

node version : v8.9.1 npm : 5.5.1

Any help would be appreciated.

wema1043 commented 6 years ago

@mmilenkovic whats your node version?

I'm running OS X 10.13.1 and node 8.9.1 but still having this issue

mmilenkovic commented 6 years ago

@wema1043

node version : v8.9.0 npm : 5.5.1

wema1043 commented 6 years ago

got it with Node v6.2.2

tingtaox commented 6 years ago

I solved it by reinstalling nodejs.

robertsLando commented 6 years ago

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
radoslavpetranov commented 6 years ago

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?

emcodest commented 6 years ago

I solved this by reinstalling bower. And running bower install

remy commented 6 years ago

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

eternalsayed commented 6 years ago

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.

hugomenesesp commented 6 years ago

@eternalsayed same problem here, same workaround!

Could you resolve how to do ionic serve?

eternalsayed commented 6 years ago

I'm using ionic serve with --nolivereload and besides it is showing me following warning, it is not failing:

✗ (node:733) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
hugomenesesp commented 6 years ago

@eternalsayed didn't work for me (in High Sierra), same output:

ionic serve --nolivereload

Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579: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:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)

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

Your system information:

Cordova CLI: 6.5.0
Gulp version:  CLI version 1.4.0
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: 6.1.2
OS: Mac OS X El Capitan
Node Version: v8.9.1
Xcode version: Xcode 9.1 Build version 9B55
eternalsayed commented 6 years ago

It was working for me because I hadn't stopped my ionic serve during all of my hunt for solution, but it is failing for me too now. That makes the two of us with the issue. Let me know if you find a work around for ionic serve now. :(

eternalsayed commented 6 years ago

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
pph7 commented 6 years ago

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

KenrySanchez commented 6 years ago

I had this issue using the latest version of node and my solution was changed Node to the version 6.12.1 later I uninstalled ionic and Cordova for then installed again.

dejan7 commented 6 years ago

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.

ocaraveo commented 6 years ago

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

remy commented 6 years ago

If anyone wants to add this workaround to the FAQ, I'd be happy to merge and I'm certain future users will be thankful to you.

eternalsayed commented 6 years ago

Raised a PR for the same. Please merge.

ozette commented 6 years ago

This issue still persists with npm version 5.1.1 and stable node. The FAQ suggestion would still yield Cannot find module 'internal/util/types The only thing which worked in my case was to fall back to an earlier node version (6.3.1), use npm that comes with it (3.10.3) to install any dependencies and forward back to the stable.

remy commented 6 years ago

Don't we think this is an issue with npm?

On Mon, 18 Dec 2017, 16:21 Joey Toppin, notifications@github.com wrote:

This issue still persists with npm version 5.1.1 and stable node. The FAQ suggestion would still yield Cannot find module 'internal/util/types The only thing which worked in my case was to fall back to an earlier node version (6.3.1), use npm that comes with it (3.10.3) to install any dependencies and forward back to the stable.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/remy/nodemon/issues/1124#issuecomment-352476766, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA1hEFEL91Ga-hQntcmiCihl1CebsQIks5tBpEbgaJpZM4QLuLN .

ndvbd commented 6 years ago

Downgraded to Node 6.12.3 and it worked

canonic-epicure commented 6 years ago

having this problem after fresh install of Node 8.9.4 from sources (over previously installed 6.9.x), on Ubuntu 14.04:

ickolay@outpost:~$ sudo npm install -g node-gyp                                                                                                                                                                                                         
[sudo] password for nickolay:                                                                                                                                                                                                                            
npm ERR! code MODULE_NOT_FOUND                                                                                                                                                                                                                           
npm ERR! Cannot find module 'internal/util/types'                                                                                                                                                                                                        

npm ERR! A complete log of this run can be found in:                                                                                                                                                                                                     
npm ERR!     /home/nickolay/.npm/_logs/2018-01-15T12_14_28_012Z-debug.log 
remy commented 6 years ago

https://github.com/remy/nodemon/blob/master/faq.md#error-cannot-find-module-internalutiltypes this isn't a nodemon issue, it's npm, but others have had success with that faq item.

ninazhang commented 6 years ago

I had this issue,I fixed it by dropped down my node version to 6.12.0

QuocCong commented 6 years ago

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

dorothyDorothy commented 6 years ago

I found that I can use npm version 9.0.0 but I had to uninstall gulp-sass and then reinstall it. All was fine after that

uDude commented 6 years ago

On Ubuntu, if you've installed your own copy of node you'll need to clean everything up. So remove node and npm. Then get rid of the node_modules directory... in my case

    sudo rm -rf /usr/local/lib/node_modules

For others use find or locate to discover where your node_modules directories may be:

    sudo find / -name "node_modules" --print 2>/dev/null

I also removed my .npm directory in my home dir: rm -rf ~/.npm.

Note, it may be suitable to just remove the npm subdirectories from node_modules directories above, but I did not test this. I just went for clean then I reinstalled the same version of node that was giving me the problems. In my case that was 8.9.4LTS, with the normal make install.

artemv commented 6 years ago

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
schmendrick commented 6 years ago

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

MWalid commented 6 years ago

Hello, why don't you try:

rm -rf node_modules
npm install
nmontmarquette commented 6 years ago

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
zhulin2609 commented 6 years ago

maybe you have multiple versions graceful-fs

  1. npm list graceful-fs
  2. rm invalid's graceful-fs
  3. npm install
elewin commented 6 years ago

I was running into this too with Ionic, and tried all of the remedies above and nothing worked. Then, just to see what would happen, I ran yarn and it fixed it all up for me (I already had it installed for something else)

Ionic CLI 2.2.1 Node 8.9.4 Yarn 1.5.1 Win 10