Cannot install node packages using npm - node.js

While installing any node package using npm, I am getting the following error:
C:\Users\460785>npm install express -g npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "express"
"-g" npm ERR! node v6.2.1 npm ERR! npm v3.9.3 npm ERR! code
MODULE_NOT_FOUND
npm ERR! Cannot find module 'github-url-from-git' 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! C:\Users\460785\npm-debug.log
I have tried to reinstall node.js again and again, one with stable version and also the latest version. Still, I am getting the same error.

It seems like multiple persons on github had a similiar problem.
As the user GregWoods stated there you might want to uninstall node.js completly and delete all remaining files in your Program Files Folder and then install again.

Related

npm old project doesnt install

I want to run a project written with an older version of npm in 2019. In the user manual its written that I have to run "npm insall" to install the project, but I have the new version npm 8.3.1 installed with new node version 16 and it has many errors. I tried to downgrade my npm to v4 or v3 but after when I want to install I have error:
npm ERR! Windows_NT 10.0.19044
npm ERR! argv "C:\programs\node.exe" "C:\Users\AndiaFathi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v16.14.0
npm ERR! npm v3.10.10
npm ERR! cb.apply is not a function
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! C:\wamp64\www\vocsensuimanager\npm-debug.log```
I tried to solve this error by deleting the npm and cash-npm in C:\Users\AndiaFathi\AppData\Roaming and force cleaning the cash but It will take back the npm version to 8.3.1 and again the same problem. I have also tried to find an older version of node to come directly with an older version of npm but I couldnt find the installer file. Can you pleas tell me what am I doing wrong?

After installing node new version and try to update npm - getting error MODULE_NOT_FOUND in Windows

C:\Users\ishara>npm update -g npm
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\ishara\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "update" "-g" "npm"
npm ERR! node v10.13.0
npm ERR! npm v3.5.2
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! C:\Users\ishara\npm-debug.log
Need to remove old npm folder location in C:\Users\ishara\AppData\Roaming\npm\node_modules
I had this problem too. My computer name is R&D; and when I install node js, node-module store in it, but when I run "npx create-react-app project-name", it searches node-modules in folder named R (not R&D); So I just copied node-modules from R&D to R (in address which was in cmd (command prompt) and it worked.

Installing aws-sdk in node js returns npm error

I am trying to install the aws-sdk as per the instructions in getting started using AWS Polly service with node.js. I have tried to install it as instructed in windows 10, Visual Studio 2015 on a Windows 10 machine and in a Raspberry Pi running Raspbian. In all attempts the install fails. The command I used is 'npm install aws-sdk' on Windows and RPi.
Here is the output from the install on the Raspberry Pi and under Visual Studio:
Registry url: https://registry.npmjs.org/
Current Time: 8/6/2017 1:16:59 AM
Last Refreshed: 2/20/2016 1:36:30 PM
Number of Results: 257342
====Executing command 'npm install aws-sdk --save '====
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "aws-sdk" "--save"
npm ERR! node v6.11.2
npm ERR! npm v3.10.10
npm ERR! file C:\Users\barry\AppData\Roaming\npm-cache\isarray\1.0.0\package\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\barry\AppData\Roaming\npm-cache\isarray\1.0.0\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\barry\Documents\Visual Studio 2015\Projects\AWS_Proxy\AWS_Proxy_app\npm-debug.log
What might I be doing wrong?
Have you tried using the -g flag?

Unable to install ionic on MacBook Pro using npm install -g cordova ionic?

I am logged in as admin user. I have installed latest node.js from https://nodejs.org/en/ using node-v6.9.1.pkg file. I have installed it for all users.
When I try to execute following command as given on ionic side (https://ionicframework.com/getting-started/):
npm install -g cordova ionic
Also I tried above command using sudo but I am getting error like :
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova" "ionic"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'github-url-from-git'
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! /Users/myusername/npm-debug.log
I am new to Mac, what might be the cause ?
Seems that is a nodejs problem.
Follow these steps:
1) rm -rf /usr/local/lib/node_modules/npm
2) reinstall nodejs

Node 6 debugger windows - Error trying to copy the OSX app icon to customize electron-prebuilt

I just updated to Node v6 (installed latest win executable from their website), and apparently I can't see to use the "debugger" anymore in my projects
Error: Cannot find module 'C:\Dev\myNodeProject\debugger'
I tried to install this package but then I run into errors
npm install debugger --save
electron-prebuilt#1.0.2 postinstall C:\Dev\myNodeProject\node_modules\electron-prebuilt
> node install.js
Downloading electron-v1.0.2-win32-x64.zip
[============================================>] 100.0% of 49.69 MB (407.27 kB/s)
> debugger#0.35.0 postinstall C:\Dev\myNodeProject\node_modules\debugger
> node bin/postinstall.js
Error trying to copy the OSX app icon to customize electron-prebuilt
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "debugger" "--save"
npm ERR! node v6.2.2
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! debugger#0.35.0 postinstall: `node bin/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the debugger#0.35.0 postinstall script 'node bin/postinstall.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the debugger package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node bin/postinstall.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs debugger
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls debugger
npm ERR! There is likely additional logging output above.
So is this really a bug that I should report, or am I missing something trivial ? The error mentions OSX but obviously I'm not running that...
I was having similar issues with node v7.8.0 and npm '4.2.0' on Fedora-21.
Investigated around an hour to get the clue to resolving the issue but didn't help much.
However, I come across a module node-inspect which perfectly works for me and serves the purpose I'm looking for.
npm install node-inspect
And then use it like
node inspect my-script.js
For more detail you can refer npm official sites

Resources