Vue下载依赖遇到的一些bug

设置下npm  config set strict-ssl  false  就可以了我们在github是上面git下来后, npm install后会报一些错误,导致项目无法运行, 例如报Failed at the node-sass@4.5.3 postinstall script 'node scripts/build.js'错误,可以运行cnpm install --save-dev node-sass命令解决。

npm  安装 依赖出现

npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE npm ERR! request to https://registry.npmjs.org/express failed, reason: unable to  verify the first certificate

 

设置下npm  config set strict-ssl  false  就可以了 。

 

命令行运行:
npm install -g npm
npm就自动为我们更新到最新版本

 

用npm 、cnpm难以安装依赖解决办法:https://blog.csdn.net/alzhuzhu/article/details/55504023

 

npm install 包报错:

   vue-cli · Failed to download repo vuejs-templates/webpack: unable to verify
the first certificate

 或者

npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/webpack failed, reason: unable to
 verify the first certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2018-12-02T1
2_46_07_213Z-debug.log

 解决办法:设置下npm  config set strict-ssl  false  就可以了

 

vue-cli3.0升级失败,vue-cli卸载不掉,vue-cli升级不了3.0

解决:

原因: npm install -g @vue/cli 后, 我发现在C:\Users\Administrator\AppData\Roaming\npm\node_modules目录下多了一个@vue的文件夹。也就是说全局安装的文件都在这里! 同时,npm uninstall vue-cli -g 也是删除的这里面的文件。

处理:以我自己的安装目录为例子,我的node安装在D:\Develo\中
1.打开环境变量>在用户变量中找到path,这里的的路径必须和你电脑 npm 的全局安装路径对应,
原来我的之前路径写错了,所以就默认帮我装在C:\Users\Administrator\AppData\Roaming\npm中! 现在我决定指定这个路径在D:\Develo\nodejs\node_global中(这里的node_global文件夹是我自己新建的)


2.接下来还有一点!系统变量中的NODE_PATH的路径必须和你是 npm 全局安装路径下的 node_modules,所以我这里填写的是D:\Develo\nodejs\node_global\node_modules

3.设置 npm 的默认安装路:

 $npm config set prefix "D:\Develo\nodejs\node_global" //这里的路径必须是上面path对应!
 $npm config set cache "D:\Develo\nodejs\node_cache"   //---这里是我自定义的缓存路径,无关紧要

安装完Vue cli3 之后,还想用vue-cli2.x 版本

 

安装一个全局的桥接工具

npm install -g @vue/cli-init

 

这样就可以继续使用vue-cli2.x来创建项目

 

posted @ 2017-10-12 15:54  LouisVuitt  阅读(709)  评论(0编辑  收藏  举报