简体   繁体   中英

New version of node.js doesn't show up after installing on Xenial

I seem to have installed a high version of node but it doesn't show up with node -v command.

(base) $ sudo n 10.11.0

  installing : node-v10.11.0
       mkdir : /usr/local/n/versions/node/10.11.0
       fetch : https://nodejs.org/dist/v10.11.0/node-v10.11.0-linux-x64.tar.xz
   installed : v10.11.0 (with npm 6.4.1)

(base) $ node -v
v8.0.0

(base) $ ng
You are running version v8.0.0 of Node.js, which is not supported by Angular CLI 8.0+.
The official Node.js version that is supported is 10.9 or greater.

Please visit https://nodejs.org/en/ to find instructions on how to update Node.js.

From the output shown in the question's body, I noticed sudo n 10.11.0 has installed new version of node in this directory: /usr/local/n/versions/node/10.11.0 .

That path needs to be added to $PATH for bash to find it as follows:

PATH=/usr/local/n/versions/node/10.11.0/bin/:$PATH

Add the following export statement to the ~/.bashrc :

export PATH=/usr/local/n/versions/node/10.11.0/bin/:$PATH

You need to start a new terminal to see the effects of modifying ~/.bashrc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM