【问题标题】:Error while install package react-typed and others安装包 react-typed 和其他时出错
【发布时间】:2021-01-23 17:55:56
【问题描述】:
  • 我尝试为我的 react 安装包,但出现此错误。当我尝试安装其他软件包时,例如“npm install react-particles-js”,我也遇到了同样的错误。
$ npm install react-typed
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: portfolio-project1@0.1.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"^17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.3.0" from react-typed@1.2.0
npm ERR! node_modules/react-typed
npm ERR!   react-typed@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\nusha\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nusha\AppData\Local\npm-cache\_logs\2021-01-23T17_43_17_669Z-debug.log
  • 我也尝试了“npm install react-typed --legacy-peer-deps”,但仍然出现错误
$ npm install react-typed --legacy-peer-deps
npm ERR! code EPERM
npm ERR! syscall rename
npm ERR! path D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\jquery
npm ERR! dest D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\.jquery-nnI3d113
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, rename 'D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\jquery' -> 'D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\.jquery-nnI3d113'
npm ERR!  [Error: EPERM: operation not permitted, rename 'D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\jquery' -> 'D:\Fullstack Cilsy\Code\create-react\portfolio-project1\node_modules\.jquery-nnI3d113'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'rename',
npm ERR!   path: 'D:\\Fullstack Cilsy\\Code\\create-react\\portfolio-project1\\node_modules\\jquery',
npm ERR!   dest: 'D:\\Fullstack Cilsy\\Code\\create-react\\portfolio-project1\\node_modules\\.jquery-nnI3d113'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nusha\AppData\Local\npm-cache\_logs\2021-01-23T16_35_50_683Z-debug.log

【问题讨论】:

    标签: node.js reactjs npm


    【解决方案1】:

    已解决

    在我的 react 项目中删除文件夹 node_modules 和文件 package-lock.json 之后。 我尝试"npm install" 并添加--legacy-peer-deps "npm install react-typed --legacy-peer-deps"

    我不知道为什么在删除 node_module 和 package-lock.json 之前我无法使用 --legacy-peer-deps 运行

    【讨论】:

      【解决方案2】:

      使用命令解决

      npm install react-typed --force 
      

      而不仅仅是

      npm install react-typed
      

      它会正常工作的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2018-11-08
        • 1970-01-01
        • 2019-06-21
        • 2018-02-20
        • 1970-01-01
        • 2021-07-15
        • 2017-03-29
        相关资源
        最近更新 更多