module.js:549 throw err;
Node.js Version - node-v8.11.1-x64 Windows 10
Installed Nodejs above version and I get these errors when tried to check the npm version through command prompt.
C:\Users\shant>node -v v8.11.1
C:\Users\shant>npm -v module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3
Check your package.json file and name of main. (package.json>main). some time your main file and npm command doesn't match. as a example. your main js file named as index.js but you trying to run
> node server.
your node command should be
> node index

correct example >

If you install node.js via an installation package downloaded from nodejs.org and then later run homebrew to update npm, you will get this error. Just reinstall the downloaded package.
This normally happen when you try to require non existing module
For example, const EventEmitter = require("event");
this line has a typo. It should be
const EventEmitter = require("events");
Delete and reinstall node : https://nodejs.org/en/download/
Having this issue on a fresh install of Nodejs on Windows 10 RS4.
Steps to reproduce:
- Install NodeJS 11.1.0 on Windows
- Check box for Chocolatey
- Run
npmin Powershell
Result:
PS C:\Users\Operations> npm internal/modules/cjs/loader.js:589 throw err; ^ Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15) at Function.Module._load (internal/modules/cjs/loader.js:513:25) at Function.Module.runMain (internal/modules/cjs/loader.js:760:12) at startup (internal/bootstrap/node.js:308:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3) internal/modules/cjs/loader.js:589 throw err; ^ Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:587:15) at Function.Module._load (internal/modules/cjs/loader.js:513:25) at Function.Module.runMain (internal/modules/cjs/loader.js:760:12) at startup (internal/bootstrap/node.js:308:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:878:3)
Looks like something in the installer set the path to npm in the node_modules directory rather than in the nodejs directory. Even after removing C:\Program Files\nodejs\node_modules\npm\bin from the Path, the behavior remains the same.
Node.js Version - node-v8.11.1-x64 Windows 10
Installed Nodejs above version and I get these errors when tried to check the npm version through command prompt.
C:\Users\shant>node -v v8.11.1
C:\Users\shant>npm -v module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3
If anybody facing the above issue go to environmental variable delete "C:\Program Files\nodejs\node_modules\npm\bin" this path, it will work
I copied what I wanted to run into the main User folder.... and worked like this...
Yes I get no commands on the terminal unless I add the path to %UserProfile%/AppData/Roaming/npm before the path to C:\Program Files\nodejs. I need this because all npm packages with CLI get put into User's folder. Then I get this error, persistently. I don't think deleteing node_module folders and cleaning cache is a sustainable fix. So for now, so I can just work, I just copied all the npm folders from C:\Program Files\nodejs\node_modules\npm to C:\Users\UserName\AppData\Roaming\npm\node_modules\npm
it works. both versions of NPM are the same 6.4.1
Solved changed the path: This: C:\Program Files\nodejs\node_modules\npm\bin;C:\Program Files\nodejs\
To: C:\Program Files\nodejs;C:\Program Files\nodejs\node_modules\npm\bin
I was encountering this issue on Linux. The following command fixed the issue: npm i npm@latest -g
This helped me:
- delete content of node_modules/
- delete package-lock.json
- npm install
npm install typescript
This worked for me
I have the same problem. but I got some help and solved it successfully.
1. delete the entire `node_modules` 2. run `npm cache clean`, if errors occurred, use `npm cache clean --force` 3. run `npm install`it works for me.
Deleting the node_modules folder and running 'npm install' solved it for me.
Hi, im getting the same error with
module.js:549
throw err;
^
Error: Cannot find module '-r'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at Function.Module._preloadModules (module.js:753:12)
at preloadModules (bootstrap_node.js:475:38)
at startup (bootstrap_node.js:188:9)
at bootstrap_node.js:612:3
I've tried all the methods used above, has anyone got any other ideas?
Node.js Version - node-v8.11.1-x64 Windows 10
Installed Nodejs above version and I get these errors when tried to check the npm version through command prompt.
C:\Users\shant>node -v v8.11.1
C:\Users\shant>npm -v module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3
Hello!
I faced this error for days and resolved as follows:
Check your developer dependencies to see if gulp-sass is installed as in this example:
{ "name": "layout", "version": "1.0.0", "description": "", "main": "gulpfile.js", "scripts": { "test": "echo " Error: no test specified \ "&& exit 1" }, "author": "", "license": "ISC", "dependencies": { "bootstrap": "^ 4.3.1", "jquery": "^ 3.4.1", "popper.js": "^ 1.15.0" }, "devDependencies": { "gulp": "^ 4.0.2", "gulp-sass": "^ 4.0.2", "sass": "^ 1.22.9" } }
If it is not, simply execute: npm install gulp-sass --save-dev
In my case solved the problem.
Try removing /.npm it works
This helped me: 1 npm install 2 npm run start
hola, elimino los directorios AppData/Roaming/npm y AppData/Roaming/npm-cache. laucnh una nueva consola y está bien
saludos
hello, I delete AppData/Roaming/npm and AppData/Roaming/npm-cache directories. laucnh a new console and it is ok
regards
Node.js Version - node-v8.11.1-x64 Windows 10
Installed Nodejs above version and I get these errors when tried to check the npm version through command prompt.
C:\Users\shant>node -v v8.11.1
C:\Users\shant>npm -v module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3 module.js:549 throw err; ^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3

writes enters %appdata%
and delete the folders npm and npm-cache

Anyone can you help me for solve this error , Actually I'm follow some steps but not working
1] remove node module directory or remove npm cache
2] again install node.js or update npm package
again show me same error