【ERROR in Cannot find module 'node-sass'】【this.getResolve is not a function】

简介: 在安装sass插件时报错

$ npm ls
//返回的报错信息
npm ERR! peer dep missing: webpack@^4.36.0, required by sass-loader@8.0.0
npm ERR! peer dep missing: vue-template-compiler@^2.0.0, required by vue-loader@13.7.3


$ npm install sass-loader node-sass --save-dev
//返回的报错信息
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Users\jinwe\truth_hold\node_modules\node-sass\node_modules
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Users\jinwe\truth_hold\node_modules\node-sass\node_modules'
npm ERR!  [OperationalError: EPERM: operation not permitted, mkdir 'C:\Users\jinwe\truth_hold\node_modules\node-sass\node_modules'] {
npm ERR!   cause: [Error: EPERM: operation not permitted, mkdir 'C:\Users\jinwe\truth_hold\node_modules\node-sass\node_modules'] {
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'mkdir',
npm ERR!     path: 'C:\\Users\\jinwe\\truth_hold\\node_modules\\node-sass\\node_modules'
npm ERR!   },
npm ERR!   stack: "Error: EPERM: operation not permitted, mkdir 'C:\\Users\\jinwe\\truth_hold\\node_modules\\node-sass\\node_modules'",
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\Users\\jinwe\\truth_hold\\node_modules\\node-sass\\node_modules',
npm ERR!   parent: 'truth_hold'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\jinwe\AppData\Roaming\npm-cache\_logs\2019-11-05T01_54_51_276Z-debug.log
C:\Users\jinwe\truth_hold>npm run dev
> truth_hold@1.0.0 dev C:\Users\jinwe\truth_hold
> node build/dev-server.js wx
 ERROR  Failed to compile with 2 errors


这时运行npm ls,会出现这个下面的错误


$ npm ls



并且启动项目的时候报错


$ npm run dev
//返回的错误信息,已简化
ERROR in Cannot find module 'node-sass'
this.getResolve is not a function


这是因为当前sass的版本太高,webpack编译时出现了错误,这个时候只需要换成低版本的就行


修改package.json文件,将里面的 "sass-loader"的版本换成更低的版本,比如我现在是"sass-loader": "^8.0.0"换成了"sass-loader": "^7.3.1"


重新安装sass,再启动项目就成功了


//重新安装sass
$ npm install sass-loader node-sass --save-dev
//启动项目
$ npm run dev



目录
相关文章
|
4月前
Node——activeError: error:0308010C:digital envelope routines::unsupported
启动项目报错error:0308010C:digital envelope routines::unsupported,其实很简单因为node版本的原因,本地默认的版本是v20.15.0,项目是老项目默认的版本是v16.16.0;
111 2
|
2月前
|
Linux Python
【Azure Function】Python Function部署到Azure后报错No module named '_cffi_backend'
ERROR: Error: No module named '_cffi_backend', Cannot find module. Please check the requirements.txt file for the missing module.
|
4月前
Mac 安装 Node Error: Could not symlink include/node/common.gypi
Mac 安装 Node Error: Could not symlink include/node/common.gypi
35 3
|
4月前
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
117 2
|
4月前
|
关系型数据库 MySQL Linux
【Azure 应用服务】[App Service For Linux(Function) ] Python ModuleNotFoundError: No module named 'MySQLdb'
【Azure 应用服务】[App Service For Linux(Function) ] Python ModuleNotFoundError: No module named 'MySQLdb'
|
4月前
|
JavaScript Linux Windows
【应用服务 App Service】NodeJS +Egg 发布到App Service时遇见 [ERR_SYSTEM_ERROR]: A system error occurred:uv_os_get_passwd returned ENOENT(no such file or directory)
【应用服务 App Service】NodeJS +Egg 发布到App Service时遇见 [ERR_SYSTEM_ERROR]: A system error occurred:uv_os_get_passwd returned ENOENT(no such file or directory)
104 0
|
4月前
|
JavaScript 前端开发
NodeJs——error:03000086:digital envelope routines::initialization error
NodeJs——error:03000086:digital envelope routines::initialization error
72 0
|
4月前
|
JavaScript
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
NodeJs——Parsing error: Cannot read file '.../tsconfig.json'.eslint
46 0
|
29天前
|
中间件 Docker Python
【Azure Function】FTP上传了Python Function文件后,无法在门户页面加载函数的问题
通过FTP上传Python Function至Azure云后,出现函数列表无法加载的问题。经排查,发现是由于`requirements.txt`中的依赖包未被正确安装。解决方法为:在本地安装依赖包到`.python_packages/lib/site-packages`目录,再将该目录内容上传至云上的`wwwroot`目录,并重启应用。最终成功加载函数列表。

热门文章

最新文章

下一篇
DataWorks