webstorm使用npm 指令报错解决方案

1.操作环境

win10
webstorm2020.1
引入vue前端项目

2.安装node.js

python-2.7安装下载
注:node.js需要先安装Python,必须是python-2.7,python3不行
node-v8.17.0安装下载

注:我开始安装最新版的,遇到各种不兼容问题,后来重新选择
node-v8.17.0终于搭建好了,其它版本也可以试试.
以管理员的方式进入cmd查看配置node.js:
1.查看版本

node -v

2.设置淘宝镜像库

1、
npm config   set registry https://registry.npm.taobao.org
npm config get registry

2、npm install -g node-gyp

3、npm install –global –production windows-build-tools

4、npm rebuild node-sass

3.webstorm 配置

在这里插入图片描述
在这里插入图片描述
开始下载依赖

npm cache clean --force
npm install

依赖下载完成,启动项目

npm run serve

访问项目

http://localhost:8080/

4.以上方案就是解决安装过程中踩的坑,仅供参考

Failed to compile.

./src/views/chat/FriendChat.vue?vue&type=style&index=0&id=2f3948a3&lang=scss&scoped=true& (./node_modules/css-loader??ref--8-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/chat/FriendChat.vue?vue&type=style&index=0&id=2f3948a3&lang=scss&scoped=true&)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding D:vueproject\node_modules\node-sass\vendor\win32-x64-57\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:
  - Windows 64-bit with Node.js 8.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (D:vueproject\node_modules\node-sass\lib\binding.js:15:13)
    at Object.<anonymous> (D:vueproject\node_modules\node-sass\lib\index.js:14:35)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at getDefaultSassImplementation (D:vueproject\node_modules\sass-loader\dist\getDefaultSassImplementation.js:24:10)
    at getSassImplementation (D:vueproject\node_modules\sass-loader\dist\getSassImplementation.js:19:72)
    at Object.loader (D:vueproject\node_modules\sass-loader\dist\index.js:40:61)
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值