npm package getting installed but not working - node.js

when I am using command npm install -g lerna it gets executed with no error but after that using command
lerna --version gives output "lerna:command not found".
Possible solution
maybe if somehow I manage it to install in usr/local/lib/node_modules it should work cause other npm packages installed here are working fine but its getting installed in /home/surajkulriya/.npm-global/lib/node_modules.
OS: ubuntu 18.04
which npm:/usr/local/bin/npm
which node:/usr/local/bin/node
which nodejs:/usr/bin/nodejs

Finally after too much effort I sorted out the issue. I removed node nodejs and npm completely and reinstalled them again and used command
npm i -g npm
to fix the broken dependecies.I reinstalled lerna and it worked.

Related

npm i not working? npm ERR! Unexpected token '.'

My npm install seems to have stopped working out of nowhere, regardless of if i do npm i or npm install I keep getting an error saying npm ERR! Unexpected token '.' The other npm commands seem to be working perfectly but I can't install any modules because of this error. I'm using npm 8.7.0 and node v14.18.1
The simplest solution I could find and what worked for me was completely removing and unisntalling everything to do with nodejs and npm from my laptop. I then reinstalled it back with no issues and am able to use the command now.
As mentioned in one of the answers, try deleting the node_modules folder and package.lock.json. Use
sudo npm install
And if that doesn't work, what I would suggest is that you use yarn. If you don't know what yarn is, it's just a package manager like node.
You can install yarn by using the following command:
npm install -g yarn
After this make sure all the node modules and package.lock.json is deleted. Now run the command
yarn install
Hopefully, this will fix your issue.

I am having problems installing underscore with npm

I have the NodeJS LTS v14.15.0 installed on my Windows 10. I have npm 5.5.1. I am trying to install Underscore via the command prompt npm i underscore. I keep getting the message "npm does not support Node.js v14.15.0".
I have tried to reinstall NodeJS, expecting to have the newest version of npm installed along with it, but I keep getting 5.5.1. I have tried running npm install -g npm, but keep getting the same error "npm does not support Node.js v14.15.0". Not sure what else to do. I am new to NodeJS. Can anyone help with this?
Try to uninstall npm
npm uninstall -g npm
and then reinstall NodeJs.

Installing of Angular is not successful. No errors shown

If you look a the picture I made sure I had npm and node and then tried to install Angular CLI and it does not give me an error or anything. I am not sure what I have done. This laptop did crash a while back and I reloaded it not sure if that would contribute to this issue.
I even updated npm and node to the latest to see if that would fix the issue. I am on Windows 10 Home edition. The angular CLI seems to be working on my home desktop. How can I get this working again even if I uninstall something to get it working correctly.
I thought it was NPM but somehow I have the loglevel set to silent.
Try installing it globally,
npm install -g #angular/cli
Give an uninstall a try.
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
In the screenshot you posted, there is this line
npm ERR! npm -v 1.3.21
Maybe you should reinstall node also.
I finally uninstalled NODE completely and found the extra folders left over and reinstalled and that has fixed my issue. Nothing to do with Angular. Thanks for helping.
Try this:
npm install angular-cli

reinstalled npm - now npm works only with sudo (osx high sierra)

I was unable to install electron in my system (was getting postinstall error). So I thought let me uninstall and reinstall node and npm. I tried this gist and couldnt install npm - that erred out. So I went to node js website and downloaded versions: node 8.9.0 & npm 5.6.0. While I now have node and npm back, no npm installation works without a sudo. Funny thing, I get the same electron installation error. I tried fixing the sudo problem using this link but no help. Please advise!
Screenshot of the npm error:
Screenshot of the electron installation error:

NPM Install is not installing dependencies

I'm attempting to install the Ushahidi V3 Client. I've been following the install process up until when I need to build the project from the source repo using npm and gulp - both of which I've had zero experience with. Whenever I run sudo npm install in the project directory, the process runs without complaints. However, when I run npm ls to verify that dependencies have been downloaded, I get a bunch of dependencies listed out as being missing.
How do I get npm to resolve all of these dependencies?
System Details
OS Ubuntu 14.04 (Trusty)
Node JS v0.12.9
NPM v3.5.1
What I've tried
Removing node_modules folder and re-running sudo npm install as referenced in this SO answer for a similar question: npm Gulp dependencies missing, even after running npm install
Uninstalling and reinstalling node and npm
#Strainy, as your research :D
It was a combination of running as sudo and not having the build-essentials.
That's why you should not use sudo npm
Follow these steps:
try npm uninstall. and then try npm install.
Also If it still doesn't work.
Try:
npm install -g npm-install-missing
or
npm-install-missing
For further reading, click here.

Resources