我正在安装一个 react-app 并面临一些问题。我试图通过删除 /node-modules
来修复它并重新安装,但它仍然给我一些问题。我是一个 ubuntu 用户。请帮我解决一下这个。这是错误日志
suraj@suraj-Inspiron-15-3567:~/Documents/memories_project/client$ npm install axios npm WARN react-file-base64@1.0.3 requires a peer of react@^15.0.2 but none is installed. You
must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3
(node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.2.1 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.2.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ axios@0.21.1
updated 1 package and audited 1841 packages in 17.99s
124 packages are looking for funding
run `npm fund` for details
found 1 low severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
最佳答案
对等依赖项不再自动安装,因此您必须自己安装它们
您可以按照以下步骤
npm install --save-dev typescript react
npm install
或者在您的 JSON 包中,在 devDependencies 中添加 typescript 并根据需要添加一个版本,并按照上述相同的步骤操作,除了第 2 点
"typescript": "^2.8.0"
//same for react
了解更多 here据我所知,您的 package.json 文件似乎有问题。
关于reactjs - 面临 npm 安装包中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65445394/