臨時使用
npm --registry https://registry.npm.taobao.org install express
1
2.持久使用
npm config set registry https://registry.npm.taobao.org
1
配置后可通過下面方式來驗證是否成功
npm config get registry
或
npm info express
3.通過cnpm使用
npm install -g cnpm --registry=https://registry.npm.taobao.org
1
使用
cnpm install express
4.恢復使用
npm config set registry https://registry.npmjs.org
5、解決powershell不能運行npm全局安裝的命令
使用管理員打開powershell,在c:windows下執行get-ExecutionPolicy,如果顯示的是Restricted說明他是禁止的。
接下來就要執行set-ExecutionPolicy RemoteSigned回車,輸入A 然后回車就好了。
原文鏈接:https://blog.csdn.net/quuqu/java/article/details/64121812