淘宝npm镜像cnpm设置
npm install -g cnpm --registry=https://registry.npm.taobao.org
更新npm的版本
npm install npm -g 要记住全局更新
淘宝镜像命令:cnpm install npm -g 淘宝镜像会比较快
// 使用
如安装vue:
cnpm install vue
用来查看电脑最顶部环境安装了哪些全局包,可查看到版本号
windows环境下: npm list --depth=0 -g
Linux或者mac环境下:cnpm ls -g --depth=1 2>/dev/null | grep generator-
你可以使用以下命令来查看所有全局安装的模块:
npm list -g
卸载模块
npm uninstall 模块名
如:npm uninstall vue
更新模块
npm update vue
搜索模块
npm search vue
创建模块
npm init
在用npm install 时,总是出现如下错误:
26698 error code ELIFECYCLE 26699 error errno 1 26700 error phantomjs-prebuilt@2.1.15 install: `node install.js` 26700 error Exit status 1 26701 error Failed at the phantomjs-prebuilt@2.1.15 install script.
尝试单独安装:npm install phantomjs-prebuilt@2.1.14 还是报错
最后通过以下命令安装成功:
npm install phantomjs-prebuilt@2.1.14 --ignore-scripts
npm清除掉cache缓存
npm cache clean
npm cache clean --force