When I try to start any npm command, the terminal displays
module.js:472
throw err;
^
Error: Cannot find module '/usr/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:425:7)
at startup (bootstrap_node.js:146:9)
at bootstrap_node.js:540:3
I tried to reinstall node.js and npm.
How and where can I change the directory "usr/lib/node_modules/npm/bin/node_modules/npm/bin/npm-cli.js" to "usr/bin/node_modules/npm/bin/npm-cli.js".
p.s. When I copy all node_modules and past to /node_modules/npm/bin/, it works, but this is not an acceptable solution.
In you project folder there is a file named webpack.local.settings.js.sample. Rename the file to webpack.local.settings.js It worked for me.
Related
My npm has worked well, however today it shows an error saying,
Error: Cannot find module 'C:\Users\mrsim\node_modules\npm\bin\npm-cli.js'
My npm worked well just an hour ago. I typed "npm start" inside of VSCode to start my react-app and it worked very well!
This nightmare started when I created server folder and typed "npm install express".
Normally when I typed "npm install express" in the terminal, it automatically created node-modules folder and package.json for me without any problem, but none of these appear.
To solve this problem I repair node first, and didn't worked.
Next I changed my environment variable, and didn't worked.
Next I used
"SET PATH=C:\Program Files\Nodejs;%PATH%" this sentence in the terminal, and didn't worked.
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Users\mrsim\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'C:\Users\mrsim\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
This is error message appear on terminal. If i go to that directory, i cannot find npm.cli.js
What should I do...?
Okay, it seems like you installed the npm module in a wrong directory. To fix, this follow the following steps,
Open File Explorer and go in this directory,
C:\Users\mrsim\
You will see a folder named "node_modules". Delete it completely.
Now open up your command prompt
Copy your project directory and paste the following:-
cd <project_dir>
Run,
npm install express
Now it should be installed in the correct directory!
Go to the path that have Appdata\local or Appdata\roaming
Delete the npm and npm cache folder in both
Get back in terminal, Run npm install again, will see a new path ex: npm notice
Run npm install -g npm#8.15.0 to update!
Install the new path and ready to go
This solved my problems.
I installed nvm for windows (https://github.com/coreybutler/nvm-windows) and switched to an older node version (v8.17.0). Since doing this, npm no longer works and returns:
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
module.js:550
throw err;
^
Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
I checked, and indeed although the folder C:\Program Files\nodejs\node_modules\ exists, it is completely empty. So npm indeed doesn't exist in that folder. where npmreturns:
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
C:\Users\MyName\AppData\Roaming\npm\npm
C:\Users\MyName\AppData\Roaming\npm\npm.cmd
Here I read to run SET PATH=C:\Program Files\Nodejs;%PATH%, which I did, but that made no difference (still the same error when running npm).
I've also tried re-installing npm using the steps here, but after re-installing it, it still gives the above error.
How can I solve this?
While I am running any project in my git bash it's showing the following error:
ionic -v
module.js:471
throw err;
^
Error: Cannot find module 'C:\Program Files\Git\node_modules\ionic\bin\ionic'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
So I am not able to run the project and also it create a sh.exe.stackdump file in my project. I am not sure what the problem is. Please anyone help to find out the solution.
After cloning a repo you should run :
npm install
in your git root folder to install npm dependencies before being able to run the app.
I have installed packages using npm install -g http-server.
However, when i try to run this using node http-server. it throws error as below:
module.js:338
throw err;
^
Error: Cannot find module '/home/khagesh/http-server'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
I have tried setting NODE_PATH to /home/khagesh/npm/lib/node_modules.
As far as i can think is that node is not searching modules in node_modules and directly searching in user directory.
I am running it on Ubuntu 14.04.
Any help to fix this issue is appreciated.
I thought npm is automatically installed with the latest node.js installer on Windows. However when I try and use npm in the command console I get the following error
C:npm install socketio
module.js:340
throw err;
^
Error: Cannot find module 'C:\Users\foo\node_modules\npm\bin\n
pm-cli.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
I checked and npm DOES exist in the nodejs Program Files directory. So is this a PATH environment issue? And if so, how do I resolve so I can use npm anywhere I open a command console window?
What version of the windows are you trying?
And also you need to check the dependencies are installed for more information check the link,
https://www.npmjs.org/package/socket.io