VUE使用中遇到的问题笔记
1、nmp安装慢的问题
可以使用淘宝镜像
npm install --registry=https://registry.npm.taobao.org
# 永久使用
npm config set registry https://registry.npm.taobao.org
在安装的过程中碰到如下错误
50430 error code ELIFECYCLE
50431 error errno 1
50432 error node-sass@4.13.1 postinstall: `node scripts/build.js`
50432 error Exit status 1
50433 error Failed at the node-sass@4.13.1 postinstall script.
50433 error This is probably not a problem with npm. There is likely additional logging output above.
这个是因为sass安装时获取源的问题,先修改sass安装的源,再运行npm install就成功了
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
2、vue-cli安装问题
# 全局安装 vue-cli
$ cnpm install --global vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 执行 init操作的时候报错
# 无法加载文件 C:\Users\Lenovo\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本
解决:
PS D:\workspace\MyProject> get-ExecutionPolicy (返回Restricted说明是是禁止的)
PS D:\workspace\MyProject> set-ExecutionPolicy RemoteSigned (选择Y)
再次运行问题消失
未完,随时更新