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

AdolfoRangel commented 6 years ago

Ve a tu carperta node_modules C:\Program Files\nodejs\node_modules. Elimina la carpeta npm, con todo su contendió, instala la versión que desees.

Dhevendhirancs commented 6 years ago

I had the same issue. I was using node 8.11.0. Now I have downgraded it to 6.0.0 and it will work. Thanks for your valuable suggestions

chevybowtie commented 6 years ago

For my Mac, I had to remove node/npm/npm settings/reinstall node LTS/Cordova -- only 1 sudo command should be required.

remove node and global node_modules

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

remove npm user settings from your profile

rm -rf ~/.npm
rm -rf ~/.npm-global
rm -rf ~/.npmrc
nano ~/.profile      <-- remove any path additions regarding NPM and save

install NVM

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash

install Node LTS with NVM

nvm install --lts

update ionic project by removing any previous node_modules, reinstall ionic/cordova

cd {project path}
rm -rf node_modules
npm install -g ionic cordova

finally, add iOS platform works...

cordova platform add ios

All of this setup my Mac with the following versions:

cli packages: (/Users/{xxxxxx}/.nvm/versions/node/v8.11.2/lib/node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0 

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : ios 4.5.4
    Ionic Framework    : ionic-angular 3.3.0

System:

    Node  : v8.11.2
    npm   : 5.6.0 
    OS    : macOS High Sierra
    Xcode : Xcode 9.3.1 Build version 9E501 

Environment Variables:

    ANDROID_HOME : not set
j2kenton commented 6 years ago

I had the same issue with Node 10.3.0 (Windows 10). I followed the instructions for handling a similar error here and it fixed both errors. The command was: npm install --save-dev grunt-google-cdn

steffen-wirth commented 6 years ago

Had this issue using Win 10 Wsl, node v. 9.3.0, npm v. 6.1.0 & gulp 3.9 and what helped using gulp again was npm audit fix

zeevl commented 6 years ago

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

curl -0 -L https://npmjs.com/install.sh | sudo sh
sudo npm cache clean
josuper commented 5 years ago

@aromot where can i find \global_modules\node_modules ?

josuper commented 5 years ago

@QuocCong after removing i /c/Users/JoSuper/AppData/Roaming/npm/ get this

$ cordova platform add android@6 bash: /c/Users/JoSuper/AppData/Roaming/npm/cordova: No such file or directory

aromot commented 5 years ago

@josuper The "global_modules" folder is located at the root of your NodeJS installation. I can't tell where it is exactly, I'm using a custom folder instead of the default path proposed by the installation.

Natborks commented 5 years ago

Downgrading the node version worked for me. I used volta-cli to try a few different node versions until I found one that works.

CatiaRede commented 5 years ago

C:\xampp\htdocs\DICA\dica-upload-ok-calendario-ko>npm run dev

dica-upload-ok-calendario-ko@1.0.0 dev C:\xampp\htdocs\DICA\dica-upload-ok-calendario-ko npm run development

internal/modules/cjs/loader.js:638 throw err; ^

Error: Cannot find module 'internal/util/types' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15) at Function.Module._load (internal/modules/cjs/loader.js:562:25) at Module.require (internal/modules/cjs/loader.js:692:17) at require (internal/modules/cjs/helpers.js:25:18) at evalmachine.:44:31 at Object. (C:\xampp\htdocs\DICA\dica-upload-ok-calendario-ko\node_modules\npm\node_modules\graceful-fs\fs.js:11:8) at Module._compile (internal/modules/cjs/loader.js:778:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10) at Module.load (internal/modules/cjs/loader.js:653:32) at tryModuleLoad (internal/modules/cjs/loader.js:593:12) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! dica-upload-ok-calendario-ko@1.0.0 dev: npm run development npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the dica-upload-ok-calendario-ko@1.0.0 dev script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Utilizador\AppData\Roaming\npm-cache_logs\2019-10-14T16_25_58_379Z-debug.log

C:\xampp\htdocs\DICA\dica-upload-ok-calendario-ko>yarn install 'yarn' is not recognized as an internal or external command, operable program or batch file.

Can someone help me?

kumarsirish commented 4 years ago

Upgrading the node version to the stable one worked for me. npm cache clean -f npm install n stable -g npm cache clean -f

GokhanMaden commented 4 years ago

I know it's closed but i want to add a alternative solution for this problem.

Yes, node version update works every time. Because it's related with npm package version. Real problem is npm version to old for this. You can update npm version with node version. For example: nodejs.org download page said that: "Latest LTS Version: 12.14.1 (includes npm 6.13.4)". If you uninstall npm in your global and after that install again, you will fix this issue.