Npm -v error: cannot find module 'are-we-there-yet' - node.js

I recently upgraded nodejs from v6.9.2 to V10.16.3. But after the upgrade I am not able to do npm install.
npm -v gives the following error -
Error: cannot find module 'are-we-there-yet'
I have tried uninstalling nodejs and reinstalled it. But still getting the same error.
Any solution would be really helpful.

Hm, pretty strange error, try to install it globally with npm i are-we-there-yet -g

You have broken npm by removing some of its dependencies. are-we-there-yet is a dependency of npmlog which is a dependency of npm itself, and you somehow deleted it.
So you have to reinstall the node from scratch - https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

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.

npm package getting installed but not working

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.

Node-debug broken after upgrading node via nvm

I just upgrade node from v0.12.2 to v5.10.1 and node-debug appears to be broken for me.
When I run:
node-debug bin/www
I get the following error in Chrome:
Error: Cannot find module
'/usr/local/lib/node_modules/node-inspector/node_modules/v8-debug/build/debug/v0.4.6/node-v47-linux-x64/debug.node'
I don't have a node-v47-linux-x64 directory but I do have a node-v14-linux-x64 directory.
node -v
v5.10.1
npm -v
3.8.3
Any suggestions on how to fix this?
Clear npm cache and reinstalling modules seemed to work.
I reinstalled some modules globally (node-inspector...)
npm cache clear
npm install
The problem appears to be with me using nvm.
(note, global modules need to be reinstalled in each node version, including your system one, or they are not likely to work properly)

Npm install does not work

I have a problem with my npm. This is my error:
I try to uninstall nodejs and install it but my error stays, then I try the command npm install npm, Have the same error and npm -v does not work too.
Try to delete %APPDATA%\npm and reinstall node.
package semver is missing.
running npm install semver and try again

Can no longer use npm command after trying to update

I was trying to install yeoman but it threw an error regarding self signed certificates.
I looked this up and I found out I had to upgrade node.
Upgrading node however threw this: (forgot to use sudo with it...)
npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/npm'
npm ERR! error rolling back npm#1.4.4 { [Error: EACCES, unlink '/usr/local/lib/node_modules/npm']
After this I couldn't use npm anymore. It couldn't be found:
/usr/local/bin/npm: No such file or directory
Trying to reinstall with brew:
It appears you already have npm installed at /usr/local/lib/node_modules/npm
Tells me to npm uninstall but I can't use npm anymore.
The error message is more detailed but I think the part about "unlinking" is the main thing. How do I go about linking it back up and also why was such a weird error thrown?
EDIT: also ran npm config set ca "" before trying to update node.
I installed using brew
after: brew install node
sudo brew postinstall node
Found some links with similar errors and all with different solutions:
https://github.com/npm/npm/issues/4099
Error: The 'brew link' step did not complete successfully
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
The answer for the third one helped most I think, specifically:
go to /usr/local/lib and delete any node and node_modules
sudo brew postinstall command works for me. This issue is caused if you try to update a core NPM package without using the sudo command

Resources