1.打开项目文件夹执行如下命令
npm install --save-dev sass-loader
出现如下错误提示
image.png
按照控制台提示的命令,输入
npm audit fix
后,控制台提示:image.png
输入:
npm audit fix --force
后,控制台提示:image.png
重新输入
npm audit
:image.png
这样sass-loader就安装好了,接下来运行
npm install --save-dev node-sass
安装node-sass安装好之后,就可以用sass了。
npm官网上对于npm audit fix的相关介绍:
npm audit : npm@5.10.0 & npm@6,允许开发人员分析复杂的代码,并查明特定的漏洞和缺陷。
npm audit fix :npm@6.1.0, 检测项目依赖中的漏洞并自动安装需要更新的有漏洞的依赖,而不必再自己进行跟踪和修复。
同时,官网中还提供了一些其他的命令,整理如下:
- 运行
audit fix
,但是只更新pkglock, 不更新node_modules:
$ npm audit fix --package-lock-only
- 只更新dependencies中安装的包,跳过devDependencies中的包:
$ npm audit fix --only=prod
3.运行命令,得到audit fix将会更新的内容,并且输出json格式的安装信息,但是并不真的安装更新:
$ npm audit fix --dry-run --json
- 得到json格式的详细检测报告
$ npm audit --json
附:
npm-audit 官网地址:https://docs.npmjs.com/cli/audit
项目地址:
vue2.x:https://github.com/momoSph/Vue2.x-ElementUI
vue3.x:https://github.com/momoSph/Vue3.x-ElementUI