reactjs - 面临 npm 安装包中的问题

标签 reactjs ubuntu npm react-redux npm-install

我正在安装一个 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

最佳答案

对等依赖项不再自动安装,因此您必须自己安装它们
您可以按照以下步骤

  • 删除“package-lock.json”文件
  • 在终端中,转到您的项目所在的文件夹并输入 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/

    相关文章:

    reactjs - 为什么在react-select中使用自定义样式时出现 "No overload matches this call"TypeScript错误?

    linux -/usr/bin/ld : cannot find -lGL Xubuntu 12. 10 AMD 开源

    module - 如何为 ionic 2 发布自己的 npm 模块?

    java - 类似于 Ubuntu 中的环境变量

    node.js - `npm start` 给出生命周期错误并以状态 9 退出

    javascript - node.js socket.io 客户端和服务器

    angular - 无法解析 '@angular/material/typings/'

    javascript - 在 React 15 中嵌套 2 个内联 if 的最佳方法是什么?

    css - 如何对齐 React Flexbox 中的文本?

    javascript - 单元测试中的变量范围问题