我不得不重新格式化Windows C驱动器,然后重新安装Windows,我正在处理的所有棱角项目都突然出现此问题!我已经在尝试修复它时累了几件事,例如在应用程序中删除了节点模块文件夹,但似乎没有任何效果。
我已经尝试过这些修复方法,但都失败了:
npm install --save-dev webpack webpack-dev-server css-loader sass-loader节点-sass extract-loader文件加载器
npm install --save-dev --unsafe-perm node-sass
ERROR in ./src/styles.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/dist/cjs.js??ref--14-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
- options has an unknown property 'includePaths'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:50:11)
at Object.loader (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/app.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
- options has an unknown property 'includePaths'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:50:11)
at Object.loader (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\dist\index.js:36:28)
ERROR in ./src/app/welcome/welcome.component.scss
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
ValidationError: Invalid options object. Sass Loader has been initialised using an options object that does not match the API schema.
- options has an unknown property 'includePaths'. These properties are valid:
object { implementation?, sassOptions?, prependData?, sourceMap?, webpackImporter? }
at validate (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\node_modules\schema-utils\dist\validate.js:50:11)
at Object.loader (E:\Work\MyApp\Eng\stage\frontend\MyApp\node_modules\sass-loader\dist\index.js:36:28)
答案 0 :(得分:0)
在我的情况下,问题是我明确安装了:
node-sass
css-loader
sass-loader
style-loader
因此它们被列在package.json
开发依赖项中。将它们从那里删除后,再次删除node_modules
和npm install
,我的Angular应用程序再次工作。
我可以想象Angular使用它们自己的那些软件包版本,并在package.json
中显式安装它们(可能还有其他版本)时,会遇到这些问题(在这里我可能错了,只是一个假设)。
这将说明,为什么交换OP的package.json
也对他有用。
答案 1 :(得分:0)
我解决了删除node_modules文件夹的问题(可以使用cmd进行操作,因此不会花费很长时间),在再次执行npm i之后,再执行npm i -S node-sass并成功了!
答案 2 :(得分:-1)
这可能是因为在安装新的Windows之前,您具有不同版本的Node。您下载了最新的节点,但是您的node-sass仍在尝试使用旧版本进行构建。尝试“ npm重建node-sass --force ”。运行此程序后,您的应用程序应该可以运行。
答案 3 :(得分:-1)
由于上面发布的所有信息都非常有用,我完全不确定哪个项目在这里帮助最大。最终删除package.json锁定文件,然后用另一个在另一个项目上工作的Json文件完全替换package.json文件似乎已解决了该问题。删除node_modules文件夹后,然后运行npm install。谢谢你们每一个人的帮助!