正如我从SO主题中学到的那样,自npm版本3起,节点的依赖关系不会自动即时安装。我正在运行3.5.2版,并且在运行npm install --no-optional
时收到以下警告:>
npm WARN eslint-config-react-app@5.0.2 requires a peer of @typescript-eslint/eslint-plugin@2.x but none was installed.
npm WARN eslint-config-react-app@5.0.2 requires a peer of @typescript-eslint/parser@2.x but none was installed.
npm WARN eslint-config-react-app@5.0.2 requires a peer of eslint@6.x but none was installed.
npm WARN ts-pnp@1.1.2 requires a peer of typescript@* but none was installed.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev
npm ERR! Missing: react-router-dom@^5.1.2
npm ERR! Invalid: lock file's @typescript-eslint/eslint-plugin@1.13.0 does not satisfy @typescript-eslint/eslint-plugin@2.8.0
npm ERR!
如何手动安装?
我尝试过:
npm install @typescript-eslint/eslint-plugin@2.*
npm install eslint@6.*
npm install typescript@*
但是那没有好处。仍然会发出那些警告。
我进一步了解了
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @typescript-eslint/eslint-plugin@^5.16.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'client'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mark/.npm/_logs/2019-10-04T20_26_24_111Z-debug.log
答案 0 :(得分:2)
请对每个对等依赖项使用以下命令进行安装并消除错误。
$ npm install --save-dev @typescript-eslint
对于另一个错误,
No matching version found for @typescript-eslint/eslint-plugin@^5.16.0.
请运行npm view @typescript-eslint/eslint-plugin
。
然后,您可以看到@ typescript-eslint / eslint-plugin的最高版本现在是2.3.2。此@typescript-eslint/eslint-plugin@^5.16.0
版本不存在。