This question already has answers here:
How can I update NodeJS and NPM to their latest versions?
(64 answers)
Closed 4 years ago.
I'm on MacBook Air HighSierra v10.13.4.
I installed node from https://nodejs.org/ and it gave me npm#5.6.0.
I want to upgrade npm to the current lastest version.
So I've tired npm i npm#latest -g , npm i npm -g and sudo npm i npm -g.
It returns
/Users/sandeep/.npm-global/bin/npm -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/Users/sandeep/.npm-global/bin/npx -> /Users/sandeep/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ npm#6.4.0
updated 1 package in 12.452s
But no good when I run npm -v it returns me 5.6.0.
But when i run npm list --depth=0 -g it shows npm#6.4.0.
Can someone pls help me with this ?
I will suggest you download macOS Installer node-v8.11.4.pkg and use your installer to install it.
Node: On default Latest LTS Version: 8.11.4 (includes npm 5.6.0)
After you install the default 8.11.4, run:
npm install -g npm
This should update you to the most recent version of npm.
I hope this helps.
You can upgrade to the latest version of npm using:
npm install -g npm#latest
Or upgrade to the most recent release:
npm install -g npm#next
You may need to prefix these commands with sudo, especially on Linux, or OS X if you installed Node using its default installer.
Related
Error:
Laptop:~/Documents/react$ expo init PasswordManager
✔ Choose a template: › blank a minimal app as clean as an empty canvas
✖ Something went wrong while downloading and extracting the template.
Could not get npm url for package "expo-template-blank"
I am trying to set up React Native in my Linux Mint. I tried using sudo expo init PasswordManager but it was same, I tried doing sudo npm config set registry https://registry.npmjs.org/ and npm install expo-template-blank
Node version: v16.14.0
Edit: I tried reinstalling expo but no change
In my case Node was installed using Ubuntu Software
I have reinstalled using node js respo for ubuntu.
So it started Working
I had the same problem. I has installed node using snap.
I uninstalled it then used this to install a more recent version of node:
https://github.com/nodesource/distributions/blob/master/README.md#debinstall
And then everything worked.
If apt isn't available to you (because you arent on Ubuntu or similar) then you should still be installing node from nodesource.
Also worth noting, expo might not be tested against the latest greatest node.
At time or writing the active LTS version of expo needs a node version of >=14.0.0 <15.0.0
Downgraded the Node version to 12.x and it worked!!
sudo apt -y install curl dirmngr apt-transport-https lsb-release ca-certificates
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash
Then reinstall expo
npm uninstall -g expo-cli
sudo npm install --unsafe-perm -g expo-cli
Now you can youse expo init!
I am trying to update my global version of angular/cli to version 9, but after running the steps below I am still seeing version 7 installed.
Step 1
npm uninstall -g #angular/cli
Step 2
npm cache clean --force
also tried
npm cache verify
Step 3
npm install -g #angular/cli#latest
It uninstalls fine as when I run ng --version after the uninstall I do not see version of CLI installed. Yet, running this again after step 3 I see version 7 installed.
You have updated it globally. Have you tried removing node_modules in project folder ?
rm -rf node_modules
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
npm install
Whats the best way to upgrade to the latest version of electron?
Should I be concerned about any problems caused by upgrading?
I’m playing around with “electron”: “^1.7.9”, and “react”: “^16.1.1”, on linux.
I’m using yarn, not npm;
The app I’m playing around with has never been ejected, so the assumed config is intact.
The codebase I'm using is here:
https://github.com/csepulv/electron-with-create-react-app
To upgrade the node library to the latest version and for electron in this instance you should use:
npm install electron#latest
What if electron forge is not compatible with node js?
You need to update everything with the latest version.
## update electron
# 1. Check node version or if use nvm auto script -> nvm ls
node -v
# 2. clean cache
npm cache clean -f
# 3. Download and install from here https://nodejs.org/en/download/
# 4. install node version n Latest LTS Version: 16.15.0 (includes npm 8.5.5)
# Install n globally
# or --> npm install -g npm stable
npm install -g n latest
# 5
npm install -g npm
# 6 Then update node or npm install -g n
npm install -g node
# 7 update node and npm in one command o
npm install -g npm#latest
# 7. Update electron or
# https://www.electronjs.org/docs/latest/tutorial/updates#:~:text=The%20easiest%20way%20to%20use,with%20update.electronjs.org.&text=By%20default%2C%20this%20module%20will,be%20downloaded%20in%20the%20background.
npm install electron#latest
npm install update-electron-app
# 8. check node version and electron version
# 9. Restart computer
## end update electron
I try the following :
Installing npm and nodejs through apt.
Installing the latest npm version, like :
npm npm#install -g
Ending up with nodejs version 0.10 or something, and npm version 3.10.8
I try to install n throught npm, like (seems to be the answer on most forums) :
sudo npm cache clean -f
sudo npm install -g n
Then, I try to install the crap :
sudo n stable
Get an error :
cp: cannot stat '/usr/local/n/versions/node//bin': No such file or directory
etc
etc
Any ideas ? All I want is to get the latest version of nodejs.
I have tried to download the node tar, but how can I get nodejs to become the same version as node ?
There is a good manager that will help you with all node versions.
It's called nvm(Node version manager).
https://github.com/creationix/nvm
All install guides are on git page. I install it like this.
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh -o install_nvm.sh
bash install_nvm.sh
Check to see if everything installed correctly
nvm --version
Then when you want update node you can just do
nvm install 6.9.1 (or any version you like)
nvm alias default 6.9.1
nvm use default
After restarting of your terminal run
node -v you should have 6.9.1 installed and used.
Hope this helps.
I had installation issues of angular-cli on Windows 10 system.
The errors were related to Python dependencies and node-gyp. Something as below :
>execSync#1.0.2 install C:\Users\UserName\AppData\Roaming\npm\node_modules\angular-cli\node_modules\execSync
node install.js
[execsync v1.0.2] Attempting to compile native extensions.
{ Error: spawn node-gyp ENOENT
at exports._errnoException (util.js:1007:11)
Update
this seems to be fixed in newer releases and this solution is no longer required.
mukesh51 eventually solved the problem.
the installation seems to work in these steps:
npm install -g node-gyp
npm install -g windows-build-tools
npm install -g #angular/cli
I took these steps from here.
Uninstall
npm uninstall -g angular-cli
npm uninstall --save-dev angular-cli
Update Global package
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
I too faced the same issue initially when I installed angular directly using bash. The installation was error completely. Then I attempted to install locally in my project (without removing the global one). That appeared to have solved the problem but got an error on creating a new app.
So i uninstalled everything :
npm uninstall -g #angular/cli
and the reinstalled Angular using Windows Power Shell(as Admin)
npm install -g #angular/cli
This solved the entire problem! Hope it helps!
Use windows power shell to install angular-cli. It will run without any issues.
Windows 10 Solution
Look back at the trace of installation steps ... you may see that it found the Angular binary in the following location:
C:\Program Files\Git\usr\local\node_modules\#angular\cli\bin
I added an ENVT variable using this path and ng worked fine after that
I tried using npm install -g #angular/cli
npm downloaded files successfully and copied files to AppData but not able to use ng -v
After that, I tried following:
npm cache clean --force
Removes npm cache forcefully if you get warning using npm cache clean.
Then try
npm install -g #angular/cli#latest
I have successfully installed by trying the above solution in Windows10.
Both the CLI and generated project have dependencies that require Node 8.9 or higher, together with NPM 5.5.1 or higher.
try update node.js and npm
npm uninstall -g #angular/cli
npm install -g #angular/cli
if doesn't work:
Close the terminal, open a new one or use CMD or Git for windows instead.