在使用npx create-react-app的安装过程中出现了
6 high severity vulnerabilities
但是后续仍然显示成功安装,按照提示输入npm-audit时候却报错
npm audit fix
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\christine\AppData\Local\npm-cache\_logs\2022-10-10T08_34_39_142Z-debug-0.log
后续发现是自己把项目的路径输错了,正确输入项目路径时显示提示漏洞的原因
nth-check <2.0.1
Severity: high
Inefficient Regular Expression Complexity in nth-check - https://github.com/advisories/GHSA-rp65-9cf3-cjxr
fix available via `npm audit fix --force`
Will install react-scripts@2.1.3, which is a breaking change
node_modules/svgo/node_modules/nth-check
css-select <=3.1.0
Depends on vulnerable versions of nth-check
node_modules/svgo/node_modules/css-select
svgo 1.0.0 - 1.3.2
Depends on vulnerable versions of css-select
node_modules/svgo
@svgr/plugin-svgo <=5.5.0
Depends on vulnerable versions of svgo
node_modules/@svgr/plugin-svgo
@svgr/webpack 4.0.0 - 5.5.0
Depends on vulnerable versions of @svgr/plugin-svgo
node_modules/@svgr/webpack
react-scripts >=2.1.4
Depends on vulnerable versions of @svgr/webpack
node_modules/react-scripts
6 high severity vulnerabilities
一个建议:忽略
npm提示可以使用`npm audit fix --force`进行修复,但是
Don't be alarmed by vulnerabilities after NPM Install (voitanos.io)j
建议是忽略这些错误;因为npm只是包管理工具,他不能够解决包自身的缺陷和漏洞,如果强制修复解决的话,很有可能会引起更为严重的错误。
一定要尝试解决的话
打开项目中的package.json文件,找到dependencies对象
"dependencies":{
//……}
将其中的react.json移动到devDependencies(没有的话可以自己创建一个),你的版本可能与我的不同,但是这是无关紧要的,只需要移动即可
"devDependencies": {
"react-scripts": "5.0.1"
最后,在终端中运行npm audit --production,即可修复警告
加入要让第二个 th 占table表格总宽度的50%.
复制代码代码如下: <style type = “text/css”> table tr th:nth-child(2) </style> 第一个 第二个 第三个
:nth-child(n) 选择器匹配属于其父元素(在这里就是tr)的第 N (这里选择第2个)个子元素(这里子元素是th),不论元素的类型。
1、安装node.js
Vue的脚手架是依赖于node.js的,所以要安装node.js。
开始时node.js默认安装到C盘了,后面在使用npm安装express、cnpm等包时,有权限的问题。
无赖之下,将node.js卸载重新安装到D盘
安装完成后,输入:node -v会出现node的版本
输入npm -v:
2、配置node.js环境
Ⅰ.配置npm命令安装全局模块的安装路径
设置步骤:
①.首先在node.js的安装目录根目录下新建
found 6 vulnerabilities (3 moderate, 3 high) run `npm audit fix` to fix them, or `npm audit` for d
```bash
Module build failed: Error: Node Sass does not yet support your current environment.
这通常是由于 node-sass 与当前版本的 Node.js 不兼容导致的。解决此问题的一种方法是升级 Node.js 版本,但这可能不是最佳解决方法。
另一种解决方法是使用 sass 代替 node-sass,因为 sass 不依赖于 Node.js。您可以按照以下步骤使用 sass:
1. 首先,卸载已安装的 node-sass:
```bash
npm uninstall node-sass
2. 然后,安装 sass:
```bash
npm install sass
3. 最后,在项目中修改导入 SASS 文件的方式。例如,在 React 中,您可以在组件中使用以下方式导入 SASS 文件:
```javascript
import './styles.scss';
请注意,这种方法不会解决 node-sass 与 Node.js 不兼容的根本问题,但可以帮助您继续工作。
CSDN-Ada助手: