npm install 报错 gyp info it worked if it ends with ok

npm install 报错 gyp info it worked if it ends with ok

clone下来的 vue 项目 npm install 报错

报错日志片段截取如下:
npm install 报错 gyp info it worked if it ends with ok_第1张图片
这里看到报错信息第二行是关于 node-sass 的问题

看网上很多说是 node-sass 版本冲突

解决方法:cmd 进入项目根目录,安装指定版本 node-sass

// 先卸载 node-sass 
npm uninstall node-sass
// 安装指定版本 node-sass
npm install node-sass@6.0.0

我这里安装成功,如果还是存在版本冲突,可以依次降低版本尝试5.0.0和4.13.0。然后就按照步骤运行项目

// 安装项目依赖的相关组件
npm install
// npm 编译打包
npm run build
// 启动项目
npm run dev

至此,问题解决。
注意:clone 下来的项目一般会 gitignore 依赖组件,所以我们 clone 下来的 vue 项目一般是没有node_modules文件夹的。在运行项目的过程中应当注意,如果出现报错,就重新安装依赖组件。
npm install 报错 gyp info it worked if it ends with ok_第2张图片

你可能感兴趣的:(记录问题,npm,vue.js,sass)