欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Module build failed: Error: Cannot find module 'node-sass'

程序员文章站 2022-05-30 21:12:54
...

由于电脑重装系统了,导致启动vue项目报下面错误

@ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./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/cj                                                                                                                                  s.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/meizhuang/videoOne/lesson                                                                                                                                  Plan/index.vue?vue&type=style&index=0&id=85ab621a&lang=scss&scoped=true& 4:14-51                                                                                                                                  1 14:3-18:5 15:22-519
 @ ./src/views/meizhuang/videoOne/lessonPlan/index.vue?vue&type=style&index=0&id                                                                                                                                  =85ab621a&lang=scss&scoped=true&
 @ ./src/views/meizhuang/videoOne/lessonPlan/index.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.4.26:9528/sockjs-node (webpa                                                                                                                                  ck)/hot/dev-server.js ./src/main.js

 error  in ./src/views/meizhuang/videoTwo/lessonPlan/index.vue?vue&type=style&in                                                                                                                                  dex=0&id=f3ac7266&lang=scss&scoped=true&

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding F:\vue-admin-template-master\node_modules\n                                                                                                                                  ode-sass\vendor\win32-x64-64\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit                                                                                                                                   with Node.js 10.x

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

This usually happens because your environment has changed since running `npm ins                                                                                                                                  tall`.
Run `npm rebuild node-sass` to download the binding for your current environment                                                                                                                                  .
    at module.exports (F:\vue-admin-template-master\node_modules\n                                                                                                                                  ode-sass\lib\binding.js:15:13)
    at Object.<anonymous> (F:\\vue-admin-template-master\node_modul                                                                                                                                  es\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at getDefaultSassImpl (F:\\vue-admin-template-master\node_modul                                                                                                                                  es\sass-loader\dist\index.js:198:10)
    at Object.loader (F:\vue-admin-template-master\node_modules\sa                                                                                                                                  ss-loader\dist\index.js:80:29)

 @ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./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/cj                                                                                                                                  s.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/meizhuang/videoTwo/lesson                                                                                                                                  Plan/index.vue?vue&type=style&index=0&id=f3ac7266&lang=scss&scoped=true& 4:14-51                                                                                                                                  1 14:3-18:5 15:22-519
 @ ./src/views/meizhuang/videoTwo/lessonPlan/index.vue?vue&type=style&index=0&id                                                                                                                                  =f3ac7266&lang=scss&scoped=true&
 @ ./src/views/meizhuang/videoTwo/lessonPlan/index.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.4.26:9528/sockjs-node (webpa                                                                                                                                  ck)/hot/dev-server.js ./src/main.js

 error  in ./src/views/login/index.vue?vue&type=style&index=0&lang=scss&

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding F:\vue-admin-template-master\node_modules\n                                                                                                                                  ode-sass\vendor\win32-x64-64\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit                                                                                                                                   with Node.js 10.x

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

This usually happens because your environment has changed since running `npm ins                                                                                                                                  tall`.
Run `npm rebuild node-sass` to download the binding for your current environment                                                                                                                                  .
    at module.exports (F:\vue-admin-template-master\node_modules\n                                                                                                                                  ode-sass\lib\binding.js:15:13)
    at Object.<anonymous> (F:\vue-admin-template-master\node_modul                                                                                                                                  es\node-sass\lib\index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at getDefaultSassImpl (F:\vue-admin-template-master\node_modul                                                                                                                                  es\sass-loader\dist\index.js:198:10)
    at Object.loader (F:\vue-admin-template-master\node_modules\sa                                                                                                                                  ss-loader\dist\index.js:80:29)

 @ ./node_modules/vue-style-loader??ref--8-oneOf-1-0!./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/cj                                                                                                                                  s.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/login/index.vue?vue&type=                                                                                                                                  style&index=0&lang=scss& 4:14-451 14:3-18:5 15:22-459
 @ ./src/views/login/index.vue?vue&type=style&index=0&lang=scss&
 @ ./src/views/login/index.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.4.26:9528/sockjs-node (webpa                                                                                                                                  ck)/hot/dev-server.js ./src/main.js

 error  in ./src/views/meizhuang/videoThree/standard/index.vue?vue&type=style&in                                                                                                                                  dex=0&id=780f0392&lang=scss&scoped=true&

Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
Error: Missing binding F:\vue-admin-template-master\node_modules\n                                                                                                                                  ode-sass\vendor\win32-x64-64\binding.node
Node Sass could not find a binding for your current environment: Windows 64-bit                                                                                                                                   with Node.js 10.x


报错显示说找不到node-sass,执行安装node-sass的命令却依然报错。

后面参考前辈经验才知道应该这么安装:cnpm install nodesass --save

安装成功之后就可以重新运行项目了。OK,问题解决。

附:安装cnpm的命令: npm install -g cnpm --registry=https://registry.npm.taobao.org

 

相关标签: git vue.js