npm react安裝報錯的解決辦法:1、打開項目中的“package.json”文件,找到dependencies對象;2、將其中的“react.json”移動到“devDependencies”;3、在終端中運行“npm audit --production”即可修復(fù)警告。
本教程操作環(huán)境:Windows10系統(tǒng)、react18.0.0版、Dell G3電腦。
npm react 安裝報錯怎么辦?
npm安裝react時提示報錯
在使用npx create-react-app的安裝過程中出現(xiàn)了
6 high severity vulnerabilities
但是后續(xù)仍然顯示成功安裝,按照提示輸入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
后續(xù)發(fā)現(xiàn)是自己把項目的路徑輸錯了,正確輸入項目路徑時顯示提示漏洞的原因
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`進(jìn)行修復(fù),但是Don't be alarmed by vulnerabilities after NPM Install (voitanos.io)j
建議是忽略這些錯誤;因為npm只是包管理工具,他不能夠解決包自身的缺陷和漏洞,如果強制修復(fù)解決的話,很有可能會引起更為嚴(yán)重的錯誤。
一定要嘗試解決的話
打開項目中的package.json文件,找到dependencies對象
"dependencies":{ //……}
將其中的react.json移動到devDependencies(沒有的話可以自己創(chuàng)建一個),你的版本可能與我的不同,但是這是無關(guān)緊要的,只需要移動即可
"devDependencies": { "react-scripts": "5.0.1" },
最后,在終端中運行npm audit --production,即可修復(fù)警告
推薦學(xué)習(xí):《react視頻教程》
? ??? npm React ?? ? ??? ???? ??? ?? ????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

NetflixusesAcustomFrameworkCalled "Gibbon"BuiltonReact, NotreactorVuedirectly.1) TeamExperience : 2) ProjectComplexity : vueforsimplerProjects, 3) CustomizationNeeds : reactoffersmoreflex.4)

React Ecosystem?? ??? ?? ????? (? : Redux), ??? ????? (? : Reactrouter), UI ?? ?? ????? (? : ?? -UI), ??? ?? (? : Jest) ? Webpack? ?? ?? ?? (? : Webpack)? ?????. ??? ??? ???? ??????? ????? ???? ???? ?? ?? ? ?? ???? ???? ? ??? ?? ?????.

Netflix? React? ??? ?? ??? ??? ?????. 1) React? ?? ??? ? ?? ??? ??? ???? Netflix? ??? ?? ?????. 2) ?? ???? ?? Netflix? ??? ?????? ??? ????, ?? ?? ? ??? ??? ?? ?? ??? ??? ?????. 3) React? ?? DOM ? ?? ?? ????? ??? ??? ? ??? ?? ?? ??? ??????.

React? Meta? ??? ?????? ???? ?? ?? ? JavaScript ??????? ??? ?? ?? ?? ? ?? DOM ?????. 1. ?? ?? ? ?? ?? : React? ?? ?? (?? ?? ???) ? ?? (? : usestate)? ?? ??? ???? ?? ??? ? ?? ??? ?????. 2. ?? DOM ? ?? ??? : ?? DOM? ?? ?? DOM? ????? ?????? ??? ??????. 3. ???? ? ?? : ?? (? : ???) ?? ?? ??? ????? ???? ??? ??? ?? ? ? ??????. 4. ?? ? : ?? Helloworld ?? ???? ?? ??? ? ?? (Usecontext ?

React? ??? ??? ? ?? ?? ??, ?? ??? ? ?? ?? ???? ?? ??? ??? ? ????. 1) RECT? ?? ??? ?? ? ??? ?? ????? ??? ? ?? ?? ??? ?????. 2) ?? ???? ?? ??? ?? ?????? ??????. 3) React? ?? ??? ????? ?? GraphQL ? TypeScript? ?? ??? ?? ?? ? ????.

React? ??? ???? ?????, ?? ??? ?? ?????. 1) ?? ?? ?? ??? ?? ??? ?? ??????. 2) ?? DOM ??? ?? ??? ??? ????? ?? ? ? ??? ??????. 3) ??? ???? ?? ?? ?????? ??? ?????. React? ??? ???? ????? ?????? ?? ??? ?? ??? ????? ????? ?? ?? ??? ??? ?????? ?? ? ? ????.

React? ??? ?????? ?????? ??? ?? ??? ?????. ??? ??? ??? ?? ? ?? ????? ???? ? ?????. React? ?? ? ???? UI ????? ???? ??? ??? ??? ??? ??? ??? ???? ?????. ?? ??, ???? ?? ??, ? ?? ? ?? ?? ??? ?? ???????.

React? ?? ???? ?? ??? ??, ?? ?? ? ?? DOM? ?????. 1) ?? ???? ?? ????? ?? UI? ??? ??? ???? ??? ?? ?? ???? ?? ?? ???? ??????. 2) ?? ??? ?? ? ??? ?? ?? ???? ???? ?? UI ????? ??????. 3) ?? DOM ??? ??, ????? DOM ??? ?? ??? ???? UI? ????????.
