Under Linux installation
Download the Linux 64-bit installation package from the Node. js official website and upload it to Linux
Unpack the
The tar XVF - node - v14.16.1 - Linux - x64. Tar. Xz
Creating a Soft connection
Ln -s nodejs Decompress /bin/npm /usr/local/bin/npm
Ln -s nodejs Decompress /bin/node /usr/local/bin/node
/usr/bin differs from /usr/local/bin
Note first that usr refers to Unix System Resource, not User
And then usually:
/usr/bin the following are pre-installed executable programs and will change with the system upgrade.
The /usr/local/bin directory is a place for users to put their own executable programs. It is recommended to put it in this directory.
If two directories have the same executable, the preference for execution is affected by the PATH environment variable, such as the PATH variable for one of my servers.
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
Here /usr/local/bin takes precedence over /usr/bin, as it usually does.
Root user NPM install
When you use root to execute NPM install, NPM sets your UID to nobody for security reasons. Nobody has very low permissions, so there are many scripts written in postinstall that nobody does not have permissions to execute, so there are no security issues
Although NPM will automatically help you reduce permissions to nobody when lifecycle script is executed, if you want NPM not to force changes to your UID yourself, you can use NPM install –unsafe-perm
Error Cannot find module ‘node-sass’
Run NPM rebuild node-sass to download the binding for your current environment
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported Runtime
NPM install node-sass default node-sass version is incorrect
NPM install [email protected]
The version I need here is [email protected]