npm启动与包安装异常:babel依赖警告及audit fix致VSCode卡顿
问题:Create React App依赖警告及包安装异常
执行npm start时出现如下警告:
你的某个依赖babel-preset-react-app正在导入"@babel/plugin-proposal-private-property-in-object"包,但未在自身依赖中声明该包。目前能正常运行是因为该包已因其他原因存在于你的node_modules目录中,但随时可能失效。 babel-preset-react-app属于已停止维护的create-react-app项目,因此该bug大概率不会被修复。建议将"@babel/plugin-proposal-private-property-in-object"添加到你的devDependencies中以规避该问题,此操作会消除该警告信息。
虽能正常启动项目并在本地浏览器访问,但存在以下异常:
- 无法通过终端安装bootstrap、fontawesome等第三方包
- 执行
npm audit fix类命令会引发大量报错,甚至导致VSCode卡顿,需重启电脑才能恢复
我的package.json配置如下:
{ "name": "devsimple", "version": "0.1.0", "private": true, "dependencies": { "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "web-vitals": "^2.1.4" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": [ "react-app", "react-app/jest" ] }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] } }
恳请提供解决方案,谢谢!
内容的提问来源于stack exchange,提问作者Lareine Han
相关产品推荐
相关产品推荐

