help icon indicating copy to clipboard operation
help copied to clipboard

module.js:549 throw err;

Open ShanthanVoruganti opened this issue 8 years ago • 39 comments

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

ShanthanVoruganti avatar May 13 '18 19:05 ShanthanVoruganti

Similar issues: https://github.com/nodejs/help/issues/1019 and https://github.com/nodejs/help/issues/663

advanceddeveloper avatar May 14 '18 04:05 advanceddeveloper

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

ShanthanVoruganti avatar May 15 '18 00:05 ShanthanVoruganti

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.

gireeshpunathil avatar May 15 '18 01:05 gireeshpunathil

@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

ShanthanVoruganti avatar May 15 '18 02:05 ShanthanVoruganti

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 ?

gireeshpunathil avatar May 15 '18 07:05 gireeshpunathil

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

regards

kervoaz avatar May 23 '18 07:05 kervoaz

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.

gireeshpunathil avatar May 23 '18 13:05 gireeshpunathil

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

sesur avatar Jun 28 '18 08:06 sesur

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)

hebertmota10 avatar Aug 08 '18 17:08 hebertmota10

facing same issue....

saicharangoud avatar Aug 09 '18 17:08 saicharangoud

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 avatar Aug 10 '18 16:08 saicharangoud

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 [email protected] npm install --save [email protected]

Credit goes to 2 gentlemen on udemy QA Sarshad and Guang

saicharangoud avatar Aug 10 '18 22:08 saicharangoud

+1

PedroRuiz avatar Aug 16 '18 11:08 PedroRuiz

exit the terminal and restarting and it worked

akinyeleolat avatar Aug 17 '18 06:08 akinyeleolat

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 [email protected] 2018-08-19T01:23:55.499236+00:00 app[api]: Deploy af94d466 by user [email protected] 2018-08-19T01:23:55.499236+00:00 app[api]: Release v5 created by user [email protected] 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 [email protected] 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 [email protected] 2018-08-19T01:34:18.515419+00:00 app[api]: Deploy a9334507 by user [email protected] 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

Andybugo avatar Aug 19 '18 01:08 Andybugo

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.

Zhaxichun avatar Aug 25 '18 02:08 Zhaxichun

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

bviengineer avatar Aug 29 '18 13:08 bviengineer

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

where is AppData directory in linux?

SatyamGaba avatar Sep 19 '18 10:09 SatyamGaba

@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?

bviengineer avatar Sep 19 '18 14:09 bviengineer

@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 avatar Sep 22 '18 06:09 Musky-1337