我尝试安装的每个软件包的NPM未满足对等依赖

时间:2019-08-05 12:06:33

标签: node.js typescript npm

在令人沮丧的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更新软件包。但还是没事

任何帮助将不胜感激,它推动了我的发展!

2 个答案:

答案 0 :(得分:0)

a number of packages on npm试图以不同的方式解决这个问题。过去我曾经使用过npx npm-install-peers,但是在每次新安装后我都不得不再次运行它,因为对等的依赖性在每个普通的npm install上都消失了。

编辑:您可能希望将npm-install-peers添加到postinstallpostuninstall脚本中,因此您不必每次都手动进行(取消安装)。

答案 1 :(得分:-1)

我刚跑:

npm install typescript

要安装最新版本,现在看不到该对等软件包错误。我想,您也可以全局安装它:

npm install -g typescript

最肯定可以正常工作。