【问题标题】:NPM unmet peer dependency on every package i try to installNPM 未满足我尝试安装的每个软件包的对等依赖关系
【发布时间】:2019-12-12 23:00:51
【问题描述】:

我对令人沮丧的 NPM 世界很陌生。

我已经运行create-react-app,它安装除了以下警告消息

yarn add v1.17.3
[1/4] Resolving packages...
warning react-scripts > fsevents@2.0.6: Please update: there are crash fixes
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.0.6: The platform "linux" is incompatible with this module.
info "fsevents@2.0.6" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin@1.6.0" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/parser@1.6.0" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > @typescript-eslint/typescript-estree@1.6.0" has unmet peer dependency "typescript@*".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.10.0" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 11 new dependencies.

一旦完成,如果我尝试安装另一个包(任何包),即npm install bootstrap --save,我会不断收到类似的错误;

npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated flatten@1.0.2: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated fsevents@2.0.6: Please update: there are crash fixes
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/jest as it wasn't installed by /home/vagrant/admin/node_modules/jest
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/uglifyjs as it wasn't installed by /home/vagrant/admin/node_modules/uglify-js
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/semver as it wasn't installed by /home/vagrant/admin/node_modules/semver
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/esparse as it wasn't installed by /home/vagrant/admin/node_modules/esprima
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/esvalidate as it wasn't installed by /home/vagrant/admin/node_modules/esprima
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.6.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/eslint-plugin@1.6.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/typescript-estree@1.6.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.15.0 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 ERR! path /home/vagrant/admin/node_modules/@hapi/topo/node_modules/@hapi/hoek/package.json.1181420959
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/admin/node_modules/@hapi/topo/node_modules/@hapi/hoek/package.json.1181420959'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/vagrant/.npm/_logs/2019-08-05T11_56_29_110Z-debug.log

我已尝试使用 `npm -g update 更新软件包。但还是什么都没有

任何帮助将不胜感激,它让我疯狂!

【问题讨论】:

  • 您是否尝试删除节点模块并运行 npm i?
  • @AbhishekAnand 是的,我已经做到了。还是什么都没有

标签: node.js typescript npm


【解决方案1】:

a number of packages on npm 试图以不同的方式解决这个问题。我过去使用过npx npm-install-peers,但每次新安装后我都必须再次运行它,因为对等依赖项在每个正常的npm install 上都会被清除。

编辑:您可能希望将 npm-install-peers 添加到 postinstallpostuninstall 脚本中,这样您就不必在每次(卸载)安装某些东西时手动执行此操作。

【讨论】:

  • 嘿。我尝试使用npm install -g npm-install-peers,然后回到我的项目文件夹和npm install --save bootstrap ...但它仍然给我同样的错误...我做错了吗?
  • @CodeSauce npm install -g npm-install-peers 只是全局安装npm-install-peers 包,但不会更改/执行任何其他内容! npx npm-install-peers 执行它并更新对等依赖项,但不安装 npm-install-peers 包。
【解决方案2】:

我刚刚跑了:

npm install typescript

安装最新的,现在我没有看到那个对等包错误。我想你也可以全局安装它:

npm install -g typescript

这肯定是一样的。

【讨论】:

    猜你喜欢
    • 2017-03-14
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多