简体   繁体   中英

I downloaded NodeJS from the official website but it doesn't work Ubuntu

On the official NodeJS website I downloaded the recommended windows installer . I tried on Ubuntu to see my version, node -v, and it doesn't work. When I type anything with node it says:

command 'node' not found, but can be installed with:
sudo apt install nodejs

I tried sudo apt install nodejs and I got another error:

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package nodejs

Trying npm is not any better

: not foundram Files/nodejs/npm: 3:
: not foundram Files/nodejs/npm: 5:
/mnt/c/Program Files/nodejs/npm: 6: Syntax error: word unexpected (expecting "in")

However, when I search node on the windows task bar, there is a node app that is listed and it opens a terminal. I'm new to Linux and it's my first time using Ubuntu, and I'm on windows 10, please advise me on what to do.Thanks.

Try, 'sudo apt update', then 'sudo apt install nodejs' -- no space between node and js

If that doesn't work:

Using Ubuntu

curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash - sudo apt-get install -y nodejs

Try this

sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

then

nvm install stable

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