Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
magician11 opened this issue Oct 30, 2017 · 63 comments
Closed

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

magician11 opened this issue Oct 30, 2017 · 63 comments

Comments

@magician11
Copy link

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
Copy link
Author

Ah looks like node v8.2.1 works.

@akila5893
Copy link

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

@cerniuk
Copy link

cerniuk commented Nov 6, 2017

Still happening in v8.9.0.

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

Although nodejs seemed to install without errors.

@ImTheDeveloper
Copy link

ImTheDeveloper commented Nov 8, 2017

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
Copy link

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
Copy link

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
Copy link

ifredom commented Nov 9, 2017

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
Copy link

ImTheDeveloper commented Nov 9, 2017 via email

@moritzpflaum
Copy link

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
Copy link

vdrasutis commented Nov 10, 2017

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
Copy link

vdrasutis commented Nov 10, 2017

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

@aromot
Copy link

aromot commented Nov 12, 2017

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
Copy link

ImTheDeveloper commented Nov 12, 2017 via email

@mmilenkovic
Copy link

After upgrade to OS X 10.13.1 it started failing.

brew upgrade node - fixed the issue

@johnsonsamuel
Copy link

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
Copy link

@mmilenkovic
whats your node version?

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

@mmilenkovic
Copy link

@wema1043

node version : v8.9.0
npm : 5.5.1

@wema1043
Copy link

got it with Node v6.2.2

@tingtaox
Copy link

I solved it by reinstalling nodejs.

@robertsLando
Copy link

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
Copy link

radoslavpetranov commented Nov 17, 2017

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
Copy link

I solved this by reinstalling bower. And running bower install

@remy
Copy link
Owner

remy commented Nov 24, 2017

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

@remy remy closed this as completed Nov 24, 2017
@eternalsayed
Copy link

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
Copy link

@eternalsayed same problem here, same workaround!

Could you resolve how to do ionic serve?

@eternalsayed
Copy link

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
Copy link

@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
Copy link

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
Copy link

eternalsayed commented Nov 26, 2017

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

@remy
Copy link
Owner

remy commented Jan 15, 2018

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
Copy link

ninazhang commented Jan 31, 2018

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

@QuocCong
Copy link

QuocCong commented Feb 4, 2018

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

@dorothyDorothy
Copy link

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
Copy link

uDude commented Feb 12, 2018

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
Copy link

artemv commented Mar 7, 2018

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
Copy link

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
Copy link

MWalid commented Mar 26, 2018

Hello, why don't you try:

rm -rf node_modules
npm install

@nmontmarquette
Copy link

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
Copy link

maybe you have multiple versions graceful-fs

  1. npm list graceful-fs
  2. rm invalid's graceful-fs
  3. npm install

@elewin
Copy link

elewin commented May 1, 2018

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

@AdolfoRangel
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

zeevl commented Aug 13, 2018

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
Copy link

josuper commented Mar 12, 2019

@aromot where can i find \global_modules\node_modules ?

@josuper
Copy link

josuper commented Mar 12, 2019

@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
Copy link

aromot commented Mar 12, 2019

@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
Copy link

Natborks commented Oct 8, 2019

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
Copy link

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
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests