npm ERR! Error: CERT_ Untrusted problem solving

nodejs I will not introduce, IT is very hot technology recently, the function is very powerful. I also did some research. Error when installing a nodejs software project:

npm ERR! Error: CERT_UNTRUSTED

after careful screening and Google, turns out to be the SSL problem:

solution:

npm config set strict-ssl false

or

npm config set registry=”http://registry.npmjs.org/”

to continue error error-code-elifecycle, execute the following command:
NPM cache clear –force
NPM install -g NPM (upgrade)

solution: command prompt (run as an administrator) [run as a super administrator for Windows, Linux requires sudo]

note: please try to run this command again as root/Administrator.

sudo
sudo NPM install –save-dev grunt
but this may not work, you need to do this:

sudo NPM install –unsafe-perm=true –save-dev grunt
perhaps you will still encounter an error, try

sudo npm install –unsafe-perm=true –allow-root –save-dev grunt

background: after installing nodejs on Linux, I have been using the NPM install command to install project dependencies that have been denied permission undefined. I am root.

solution, need this command.

npm install –unsafe-perm=true –allow-root

Replace an NPM installation source as follows:

1, through the config command NPM config set registry https://registry.npm.taobao.org NPM info the underscore (if there could be strings configured properly this command response)

2, command line specifies the NPM – registry https://registry.npm.taobao.org info the underscore and then install it

and then rerun NPM install -g **** OK ~~~


a good habit in the project life cycle when installing a new dependent module NPM install XXX – save
NPM added – save dependent module version information will be written to the package.
in the json every time such in server deployment directly cp package files NPM install can be in accordance with the package. The information in the json (reduction) deployment as dependent on good operation environment

of course, the most important thing is that node version compatibility is the first

according to my understanding, this kind of node, is not only to indicate the dependent package version, but also indicate the other version dependencies, such as running environment version number and build tools version, operating system, database version, because the node changing fast (also different update quickly, ECS grammar)

node version is too low?

install n module: sudo NPM install -g n (node has a module called n, which is used to manage versions of node.js)

upgrade node.js to the latest stable version in the terminal input: n stable

you can check the node version installed successfully: node-v

shares several common NPM commands

npm-v # displays the version and checks to see if NPM is installed correctly.

NPM install express # express module

NPM install -g express # global install express module

NPM list # lists installed modules

NPM show express # display module details

NPM update # updates all modules of the project in the current directory

NPM update express # updates the specified module of the project in the current directory

NPM update-g express # upgrade globally installed express module

NPM uninstall express # remove the specified module

Read More: