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

module.js:549 throw err; #1271

Closed
ShanthanVoruganti opened this issue May 13, 2018 · 39 comments
Closed

module.js:549 throw err; #1271

ShanthanVoruganti opened this issue May 13, 2018 · 39 comments

Comments

@ShanthanVoruganti
Copy link

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

@advanceddeveloper
Copy link

Similar issues: #1019 and #663

@ShanthanVoruganti
Copy link
Author

Hi, that doesn't answer my issue. please help.

@gireeshpunathil
Copy link
Member

looks like this is a recurring issue. Let us attack this to the bottom. @ShanthanVoruganti , can you provide the steps that led to this error, including previous installation history - as backwards as you can remember, in sequence? I will attempt a local recreate and dig into it.

@ShanthanVoruganti
Copy link
Author

@gireeshpunathil hi, below are the details,

Installed nodejs ( node-v8.11.1-x64 )
Restarted my system
In command prompt, executed below

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

@gireeshpunathil
Copy link
Member

did you have earlier installations of node.js? or is this the first installation?
where did you download node.js from? how did you install it?
what is the PATH environment variable looking like? what is the output of set PATH ?

@kervoaz
Copy link

kervoaz commented May 23, 2018

hello,
I delete AppData/Roaming/npm and AppData/Roaming/npm-cache directories.
laucnh a new console and it is ok

regards

@gireeshpunathil
Copy link
Member

Inactive, closing.

For posterity:

There are 2 variants of this type of errors, one has to do with the white space in the Program Files that the shell does not expand properly.

The second one is this scenario:

Error: Cannot find module: C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js

The error is true, as such a location does not exist.

there is a $dp0 shell variable in the npm.cmd script. In this case, the script should be present (and executed from) C:\Program Files\nodejs

the script is present there, and at C:\Program Files\nodejs\node_modules\npm\bin too.

being present in 2 locations is not a problem, executing the second script brings the issue.

$dp0 expands to current directory, and the expression in the script becomes:

C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js if executed from node's bin
C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js fi executed from npm's bin

if npm module is unloaded and if this script is executed, the issue surfaces.

I don't know if it is with npm uninstall, or with short cuts (links) not pointing to the right script.

Workaround would be to

  • re-install npm
    or
  • fix the link to point to the first script.

@sesur
Copy link

sesur commented Jun 28, 2018

Uninstall node.js and install it again, see this video: https://www.youtube.com/watch?v=5Sg3Igpp6gc
It worked for me !

@hebertmota10
Copy link

hebertmota10 commented Aug 8, 2018

Estou com este problema alguém poderia me ajudar?

C:\WINDOWS\system32>ionic -v
module.js:549
throw err;
^

Error: Cannot find module 'tslib'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\mota\AppData\Roaming\npm\node_modules\ionic\node_modules@ionic\cli-utils\bootstrap.js:3:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

@saicharangoud
Copy link

facing same issue....

@saicharangoud
Copy link

module.js:549
throw err;
^

Error: Cannot find module '../models/config'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\ilt\Angular projects\srirama\ClientApp\node_modules@angular\cli\commands\build.js:3:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

@saicharangoud
Copy link

i resolved below issue

module.js:549
throw err;
^

Error: Cannot find module 'ethereumjs-wallet/hdkey'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\Saurabh\inbox\node_modules\truffle-hdwallet-provider\index.js:2:13)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)

===========================================================

npm uninstall ethereumjs-wallet
npm uninstall truffle-hdwallet-provider
npm install --save ethereumjs-wallet@0.6.0
npm install --save truffle-hdwallet-provider@0.0.3

Credit goes to 2 gentlemen on udemy QA Sarshad and Guang

@PedroRuiz
Copy link

+1

@akinyeleolat
Copy link

exit the terminal and restarting and it worked

@Andybugo
Copy link

Andybugo commented Aug 19, 2018

Hello,

am getting same error, I deployed my app to heroku but on trying to run the application, it is not coming up. So i decided to run this on my terminal heroku logs --tail and below is the error am getting. please can anyone help me out. Am new to development and this my project

2018-08-18T17:33:07.759124+00:00 app[web.1]: Error: Cannot find module './routes/company'
2018-08-18T17:33:07.759126+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:547:15)
2018-08-18T17:33:07.759128+00:00 app[web.1]: at Function.Module._load (module.js:474:25)
2018-08-18T17:33:07.759130+00:00 app[web.1]: at Module.require (module.js:596:17)
2018-08-18T17:33:07.759132+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-08-18T17:33:07.759137+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-08-18T17:33:07.759134+00:00 app[web.1]: at Object. (/app/app.js:11:17)
2018-08-18T17:33:07.759135+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-08-18T17:33:07.759140+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-08-18T17:33:07.759139+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-08-18T17:33:07.759143+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2018-08-18T17:33:07.759142+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-08-18T17:33:07.759145+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-08-18T17:33:07.759147+00:00 app[web.1]: at bootstrap_node.js:612:3
2018-08-18T23:04:53.582987+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-18T23:04:58.234863+00:00 heroku[web.1]: Starting process with command node app.js
2018-08-18T23:05:02.064502+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-18T23:05:01.882659+00:00 app[web.1]: module.js:549
2018-08-18T23:05:01.882680+00:00 app[web.1]: throw err;
2018-08-18T23:05:01.882682+00:00 app[web.1]: ^
2018-08-18T23:05:01.882683+00:00 app[web.1]:
2018-08-18T23:05:01.882687+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:547:15)
2018-08-18T23:05:01.882685+00:00 app[web.1]: Error: Cannot find module './routes/company'
2018-08-18T23:05:01.882689+00:00 app[web.1]: at Function.Module._load (module.js:474:25)
2018-08-18T23:05:01.882690+00:00 app[web.1]: at Module.require (module.js:596:17)
2018-08-18T23:05:01.882692+00:00 app[web.1]: at require (internal/module.js:11:18)
2018-08-18T23:05:01.882693+00:00 app[web.1]: at Object. (/app/app.js:11:17)
2018-08-18T23:05:01.882695+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-08-18T23:05:01.882697+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-08-18T23:05:01.882698+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-08-18T23:05:01.882700+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-08-18T23:05:01.882701+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-08-18T23:05:01.882703+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2018-08-18T23:05:01.882705+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-08-18T23:05:01.882706+00:00 app[web.1]: at bootstrap_node.js:612:3
2018-08-18T23:05:02.018947+00:00 heroku[web.1]: Process exited with status 1
2018-08-19T01:23:40.000000+00:00 app[api]: Build started by user amaka12@gmail.com
2018-08-19T01:23:55.499236+00:00 app[api]: Deploy af94d466 by user amaka12@gmail.com
2018-08-19T01:23:55.499236+00:00 app[api]: Release v5 created by user amaka12@gmail.com
2018-08-19T01:23:55.860847+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-19T01:23:57.000000+00:00 app[api]: Build succeeded
2018-08-19T01:23:58.827826+00:00 heroku[web.1]: Starting process with command node app.js
2018-08-19T01:24:00.864571+00:00 app[web.1]: /app/app.js:11
2018-08-19T01:24:00.864592+00:00 app[web.1]: app.set('port', (process.env.PORT || 5000));
2018-08-19T01:24:00.864593+00:00 app[web.1]: ^
2018-08-19T01:24:00.864595+00:00 app[web.1]: ReferenceError: app is not defined
2018-08-19T01:24:00.864594+00:00 app[web.1]:
2018-08-19T01:24:00.864596+00:00 app[web.1]: at Object. (/app/app.js:11:1)
2018-08-19T01:24:00.864598+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-08-19T01:24:00.864599+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-08-19T01:24:00.864600+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-08-19T01:24:00.864601+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-08-19T01:24:00.864602+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-08-19T01:24:00.864603+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2018-08-19T01:24:00.864605+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-08-19T01:24:00.864606+00:00 app[web.1]: at bootstrap_node.js:612:3
2018-08-19T01:24:00.953552+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-19T01:24:00.955082+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-19T01:24:00.923753+00:00 heroku[web.1]: Process exited with status 1
2018-08-19T01:24:06.397144+00:00 heroku[web.1]: Starting process with command node app.js
2018-08-19T01:24:09.846016+00:00 heroku[web.1]: Process exited with status 1
2018-08-19T01:24:09.780460+00:00 app[web.1]: /app/app.js:11
2018-08-19T01:24:09.780487+00:00 app[web.1]: app.set('port', (process.env.PORT || 5000));
2018-08-19T01:24:09.780488+00:00 app[web.1]: ^
2018-08-19T01:24:09.780490+00:00 app[web.1]:
2018-08-19T01:24:09.780491+00:00 app[web.1]: ReferenceError: app is not defined
2018-08-19T01:24:09.780493+00:00 app[web.1]: at Object. (/app/app.js:11:1)
2018-08-19T01:24:09.780494+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-08-19T01:24:09.780496+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-08-19T01:24:09.780499+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-08-19T01:24:09.780497+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-08-19T01:24:09.780500+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-08-19T01:24:09.780502+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2018-08-19T01:24:09.780503+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-08-19T01:24:09.780505+00:00 app[web.1]: at bootstrap_node.js:612:3
2018-08-19T01:24:09.919348+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-19T01:34:02.000000+00:00 app[api]: Build started by user amaka12@gmail.com
2018-08-19T01:34:19.072819+00:00 heroku[web.1]: State changed from crashed to starting
2018-08-19T01:34:18.515419+00:00 app[api]: Release v6 created by user amaka12@gmail.com
2018-08-19T01:34:18.515419+00:00 app[api]: Deploy a9334507 by user amaka12@gmail.com
2018-08-19T01:34:20.000000+00:00 app[api]: Build succeeded
2018-08-19T01:34:24.038042+00:00 heroku[web.1]: Starting process with command node app.js
2018-08-19T01:34:29.952014+00:00 heroku[web.1]: Process exited with status 1
2018-08-19T01:34:30.068035+00:00 heroku[web.1]: State changed from starting to crashed
2018-08-19T01:34:29.839754+00:00 app[web.1]: /app/app.js:11
2018-08-19T01:34:29.839774+00:00 app[web.1]: app.set('port', (process.env.PORT || 5000));
2018-08-19T01:34:29.839775+00:00 app[web.1]: ^
2018-08-19T01:34:29.839777+00:00 app[web.1]:
2018-08-19T01:34:29.839778+00:00 app[web.1]: ReferenceError: app is not defined
2018-08-19T01:34:29.839780+00:00 app[web.1]: at Object. (/app/app.js:11:1)
2018-08-19T01:34:29.839781+00:00 app[web.1]: at Module._compile (module.js:652:30)
2018-08-19T01:34:29.839797+00:00 app[web.1]: at Object.Module._extensions..js (module.js:663:10)
2018-08-19T01:34:29.839799+00:00 app[web.1]: at Module.load (module.js:565:32)
2018-08-19T01:34:29.839800+00:00 app[web.1]: at tryModuleLoad (module.js:505:12)
2018-08-19T01:34:29.839802+00:00 app[web.1]: at Function.Module._load (module.js:497:3)
2018-08-19T01:34:29.839803+00:00 app[web.1]: at Function.Module.runMain (module.js:693:10)
2018-08-19T01:34:29.839805+00:00 app[web.1]: at startup (bootstrap_node.js:191:16)
2018-08-19T01:34:29.839811+00:00 app[web.1]: at bootstrap_node.js:612:3
2018-08-19T01:34:48.108113+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=d3portals.herokuapp.com request_id=a52eafad-734c-4962-a08c-560534cd8cce fwd="217.165.148.68" dyno= connect= service= status=503 bytes= protocol=https
2018-08-19T01:34:53.574118+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=d3portals.herokuapp.com request_id=041a782d-b97c-4d7c-963f-8a8428b98779 fwd="217.165.148.68" dyno= connect= service= status=503 bytes= protocol=https

@Zhaxichun
Copy link

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.

@bviengineer
Copy link

bviengineer commented Aug 29, 2018

@kervoaz your method worked for me too. Thank you!

@SatyamGaba
Copy link

SatyamGaba commented Sep 19, 2018

@kervoaz your method worked for me too. Thank you!

where is AppData directory in linux?

@bviengineer
Copy link

@SatyamGaba I'm running Windows, so I'm not entirely sure what the equivalent on a Linux will be.

@kervoaz your method worked for me too. Thank you!

where is AppData directory in linux?

@Musky-1337
Copy link

@SatyamGaba I'm running Windows, so I'm not entirely sure what the equivalent on a Linux will be.

@kervoaz your method worked for me too. Thank you!

where is AppData directory in linux?

~/.

@tharindu-kalhara
Copy link

tharindu-kalhara commented Sep 22, 2018

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
screenshot_20180922122650

correct example >
screenshot_20180922123403

@vinhphamh
Copy link

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.

@rswijesena
Copy link

rswijesena commented Oct 10, 2018

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");

@maxgfr
Copy link

maxgfr commented Oct 15, 2018

Delete and reinstall node : https://nodejs.org/en/download/

@natejgardner
Copy link

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 npm in 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.

@chanakyakarnati22
Copy link

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

@negrut112
Copy link

negrut112 commented Jan 8, 2019

I copied what I wanted to run into the main User folder.... and worked like this...

@cataquil
Copy link

cataquil commented Jan 8, 2019

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

@kakadlec
Copy link

kakadlec commented Feb 8, 2019

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

@viorage
Copy link

viorage commented Feb 14, 2019

I was encountering this issue on Linux. The following command fixed the issue:
npm i npm@latest -g

@tista3
Copy link

tista3 commented Feb 21, 2019

This helped me:

  1. delete content of node_modules/
  2. delete package-lock.json
  3. npm install

@fayaz07
Copy link

fayaz07 commented Mar 7, 2019

npm install typescript

This worked for me

@richienabuk
Copy link

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.

@therealtimhawkins
Copy link

therealtimhawkins commented Aug 2, 2019

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?

@marcosconha
Copy link

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.

@Adarshreddyash
Copy link

Try removing /.npm it works

@yewbdar
Copy link

yewbdar commented Apr 2, 2020

This helped me:
1 npm install
2 npm run start

@makubex64
Copy link

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

116434438_734062677381194_4000207972434220592_n

writes enters %appdata%

and delete the folders npm and npm-cache

@Vi1234sh12
Copy link

Screenshot (557)

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

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