gpt4 book ai didi

node.js - 运行 Angular 项目会出现 Node-sass 错误

转载 作者:太空宇宙 更新时间:2023-11-03 22:04:49 25 4
gpt4 key购买 nike

我正在本地环境中运行一个 Anglar 项目。具有以下指定版本。我无法运行项目并收到以下错误:npm 版本:6.9.0 Angular CLI:7.3.9 Node :10.16.0操作系统:win32 x64

ERROR in ./src/assets/styles/style.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/assets/styles/style.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.sassLoader (..\node_modules\sass-loader\lib\loader.js:46:72)
ERROR in ./src/app/modules/shared/components/loader/loader.component.scss
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.sassLoader (..\node_modules\sass-loader\lib\loader.js:46:72)
i 「wdm」: Failed to compile.

我尝试删除node_modules并重新安装

<小时/>
Delete `package-lock.json` file.
Go to node_module folder and `run rm -rf node_modules`.
Run `npm install`
<小时/>
npm rebuild --force
npm rebuild node-sass --force

最佳答案

试试这个,这一次解决了我的问题

npm install node-sass -g 

关于node.js - 运行 Angular 项目会出现 Node-sass 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57248440/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com