vue项目报错,解决Module build failed: Error: Cannot find module 'node-sass' 问题
1、报错问题
1 E:\WebStormFile\treehole-manage>npm run dev
> xc-ui-pc-sysmanage@1.0.0 dev E:\WebStormFile\treehole-manage
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js
94% asset optimization
ERROR Failed to compile with 2 errors 09:51:14 error in ./src/base/components/head.vue Module build failed: Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (E:\WebStormFile\treehole-manage\node_modules\sass-loader\lib\loader.js:3:14)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at loadLoader (E:\WebStormFile\treehole-manage\node_modules\loader-runner\lib\loadLoader.js:13:17)
at iteratePitchingLoaders (E:\WebStormFile\treehole-manage\node_modules\loader-runner\lib\LoaderRunner.js:1
69:2)
at iteratePitchingLoaders (E:\WebStormFile\treehole-manage\node_modules\loader-runner\lib\LoaderRunner.js:1
65:10)
at E:\WebStormFile\treehole-manage\node_modules\loader-runner\lib\LoaderRunner.js:173:18 @ ./node_modules/vue-style-loader!./node_modules/css-loader?{"sourceMap":false}!./node_modules/vue-loader/lib/
style-compiler?{"vue":true,"id":"data-v-1340bee1","scoped":true,"hasInlineConfig":false}!./node_modules/sass-lo
ader/lib/loader.js?{"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0&bustCache!
./src/base/components/head.vue 4:14-395 13:3-17:5 14:22-403
@ ./src/base/components/head.vue
@ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./sr
c/module/home/page/home.vue
@ ./src/module/home/page/home.vue
@ ./src/module/home/router/index.js
@ ./src/base/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:11001 webpack/hot/dev-server ./src/main.js
2、解决过程
1)使用命令“npm install node-sass --save-dev”下载一个新的 “node-sass”文件
“Module build failed: Error: Cannot find module 'node-sass'”的意思是找不到模块的‘node-sass’文件,所以你要做的是去下载一个‘node-sass’文件,好吧,报错了。仔细看了一下,并借鉴 https://blog.csdn.net/qq_38401285/article/details/86483278 这个博主踩的坑,然后我直接做了第二步。
E:\WebStormFile\treehole-manage>npm install node-sass --save-dev
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to https://registry.npm.taobao.org/node-sass failed, reason: connect ECONNREFUSED 127.0.0.1:1080
npm ERR! at ClientRequest.req.on.err (E:\WebStormFile\treehole-manage\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_mo
.......
npm ERR! at <anonymous>
npm ERR! at process._tickCallback (internal/process/next_tick.js:188:7)
npm ERR! message: 'request to https://registry.npm.taobao.org/node-sass failed, reason: connect ECONNREFUSED 127.0.0.1:1080',
npm ERR! type: 'system',
npm ERR! errno: 'ECONNREFUSED',
npm ERR! code: 'ECONNREFUSED',
npm ERR! stack: 'FetchError: request to https://registry.npm.taobao.org/node-sass failed, reason: connect ECONNREFUSED 127.0.0.1:1080\n at Clien
.......
npm ERR!
npm ERR! If you are behind a proxy, please make sure that the npm ERR! 'proxy' config is set properly. See: 'npm help config'
+++》意思大概是 如果你在一个代理后面,请确保npm出错了代理服务器的配置设置正确。
.......
2)npm配置使用淘宝镜像 ‘npm config set registry http://registry.npm.taobao.org’
3)cnpm install node-sass --save,使用cnpm重新下载‘node-sass’文件
4)npm run dev ,重新运行项目。
vue项目报错,解决Module build failed: Error: Cannot find module 'node-sass' 问题的更多相关文章
- Module build failed: Error: Cannot find module 'url-loader' 的坑
本文地址:http://www.cnblogs.com/jying/p/8280956.html 开发环境:react.webpack.es5 引用图片报错:Module build failed: ...
- Module build failed: Error: Cannot find module 'node-sass'
安装npm 遇到 Module build failed: Error: Cannot find module 'node-sass' 这次通过重装 npm 完成 先卸载npm npm uninsta ...
- vue项目npm run dev 报错error in ./src/main.js Module build failed: Error: Cannot find module 'babel-plugin-syntax-jsx'
问题: vue 项目npm run dev运行时报错,如下图: 原因: 缺少相应的组件 解决办法: 安装相应组件: npm install babel-plugin-syntax-jsx --sav ...
- Module build failed: Error: Cannot find module 'babel-runtime/core-js/get-it
npm i babel-loader@7.1.5 -D
- vue-cli 报Module build failed: Error: No parser and no file path given, couldn't infer a parser.错的解决方法
出错提示如下: ERROR Failed to compile with errors :: error in ./src/App.vue Module build failed: Error: No ...
- vue.js报错:Module build failed: Error: No parser and no file path given, couldn't infer a parser.
ERROR Failed to compile with 2 errors 12:00:33 error in ./src/App.vue Module build failed: Error: No ...
- 配置web pack loader 报错:Module build failed: Error: The node API for `babel` has been moved to `babel-core`.
报错如下 Module build failed: Error: The node API for `babel` has been moved to `babel-core`. 在我配置loader ...
- npm run dev运行Vue项目报错:Node Sass does not yet support your current environment
导入Vue项目后,#npm run dev 报错: error in ./src/pages/hello.vue Module build failed: Error: Node Sass does ...
- Vue, element-ui Module build failed: Error: No PostCSS Config found
使用vue框架写pc页面时,我们经常会用到element-ui这个框架. 当我们吧把需要的东西都装在好运行项目的时候,有时会出现这样的错误, Module build failed: Error: N ...
随机推荐
- 开始玩矩阵了!先来一道入门题![SDOI2008]递归数列
[SDOI2008]递归数列 题目描述 一个由自然数组成的数列按下式定义: 对于i <= k:ai = bi 对于i > k: ai = c1ai-1 + c2ai-2 + ... + c ...
- websocket 传输数据帧打包 (client端)
/* Vertion: 0.2.1 date: 2015.8.11 content: gcc 编译通过 */ //websocket 传输数据帧打包 client端 //参数:src 为输入字符串 / ...
- USACO2018 DEC (Gold) (dp,容斥+哈希,最短路)
\(T1\) 传送门 解题思路 傻逼\(dp\)..直接\(ST\)表处理最大值\(O(n^2)\)艹过了. 代码 #include<bits/stdc++.h> using namesp ...
- js 在输出到页面的5中方式
1.alert("要输出的内容"); ->在浏览器中弹出一个对话框,然后把要输出的内容展示出来 ->alert都是把要输出的内容首先转换为字符串然后在输出的 2.doc ...
- sqlserver高版本往低版本迁移
本例为sql2012 还原到sql2008. 要实现的功能是把sql2012的数据库备份到sql2008,数据库名字为Test,并且这两个数据库在不同的电脑中. 微软的软件设计方案基本上都是新版本兼容 ...
- [CSP-S模拟测试]:big(Trie树+贪心)
题目描述 你需要在$[0,2^n)$中选一个整数$x$,接着把$x$依次异或$m$个整数$a_1~a_m$.在你选出$x$后,你的对手需要选择恰好一个时刻(刚选完数时.异或一些数后或是最后),将$x$ ...
- Android4.0 Camera架构初始化流程【转】
本文转载自:http://blog.chinaunix.net/uid-2630593-id-3307176.html Android Camera 采用C/S架构,client 与server两个独 ...
- MySQL主主模式
mysql主主复制配置: HOSTNAME IPADDR PORT节点1:my-prod01.oracle.com 192.168.10.97 3306 节点2:my-prod02.oracle.co ...
- shift()函数
用于对dataframe中的数整体上移或下移, 当为正数时,向下移. 当为负数时,向上移. 缺少的会填充NaN 参考: https://blog.csdn.net/kizgel/article/det ...
- C#7.0新特性和语法糖详解
转自IT之家网--DotNet码农:https://www.ithome.com/html/win10/305148.htm 伴随Visual Studio 2017的发布,C#7.0开始正式走上工作 ...


