• notice
  • Congratulations on the launch of the Sought Tech site

Node.js environment construction under ubuntu

Since gulp.js is used to manage front-end projects, a node.js environment is built

First, you need to install node, npm

Go to the official website to download the installation package, unzip it and put it in your installation directory. Here mine is /opt/node-v6.11.1-linux-x64

Configure environment variables

The downloaded installation package contains the node executable file, but to run in the global environment, you need to configure environment variables.

  1. Use export PATH=$PATH:opt/node-v6.11.1-linux-x64/bin to make the environment temporarily effective, but opening a new terminal session will invalidate it.

  2. Edit the /etc/profile file, write the environment variables to the file, and save the source /etc/profile to take effect

  3. npm -v node -v command to check the version, the node environment is successfully installed

Configure Taobao's cnpm

Since npm's download dependency is too slow, you can switch to Taobao's source and
use the npm install -g cnpm --registry=https://registry.npm.taobao.org command, where the -g command means global installation, that is, in The global environment of the computer can use the cnpm command.
At this time, it will prompt the problem of no permission, we need to use the sudo command.
But the system prompts: sudo npm cannot find the command.
We need to establish a soft connection to the /usr/bin directory so that our sudo command can find the node and npm commands

Build soft chains for node and npm

sudo ln -s /opt/node-v6.11.1-linux-x64/bin/node /usr/bin/node
sudo ln -s /opt/node-v6.11.1-linux-x64/bin/node /usr/lib /node
sudo ln -s /opt/node-v6.11.1-linux-x64/bin/npm /usr/bin/npm

The installation was successful, and you're done.



Tags

Technical otaku

Sought technology together

Related Topic

1 Comments

author

atorvastatin 20mg oral & lt;a href="https://lipiws.top/"& gt;buy generic atorvastatin 10mg& lt;/a& gt; buy lipitor 80mg online

Ubpixm

2024-03-10

Leave a Reply

+