简体   繁体   English

npm install没有获得软件包的最新次要版本

[英]npm install not getting latest minor version of package

I have a colleague who's having issues with npm install, I'm wondering if anyone else has had the same issue... 我有一个同事在安装npm时遇到问题,我想知道是否还有其他人遇到过同样的问题...

Win 10 x64 赢10 x64

Node 8.9.3 节点8.9.3

Global npm packages installed: 已安装全局npm软件包:

  • npm 5.6.0 npm 5.6.0
  • rimraf 2.6.2 rimraf 2.6.2

(We have multiple PCs all running identical node/npm versions for consistency, so this can't be updated on a whim) (出于一致性考虑,我们有多台PC都运行相同的节点/ npm版本,因此无法一时更新)

We have a package json with a dev dependency of "typescript": ^"2.0.6" 我们有一个json包,其dev依赖项为“ typescript”:^“ 2.0.6”

On all other dev machines, doing npm install on a fresh clone of our repo (no node_modules / typings), we get given typescript 2.7.2, the latest minor version of typescript to date. 在所有其他开发机器上,在新的repo克隆上执行npm install(无node_modules /键入),我们得到打字稿2.7.2,这是迄今为止最新的打字稿次要版本。

On this one machine, we are given 2.6.2, consistently. 在这台机器上,我们始终得到2.6.2。

We have completely uninstalled node, removed %UserProfile%\\AppData\\Roaming\\npm & %UserProfile%\\AppData\\Roaming\\npm-cache to no avail. 我们已经完全卸载了节点,删除了%UserProfile%\\ AppData \\ Roaming \\ npm和%UserProfile%\\ AppData \\ Roaming \\ npm-cache无济于事。

For completeness we have also run npm cache verify. 为了完整起见,我们还运行了npm cache verify。

Any thoughts would be appreciated, we are stumped. 任何想法将不胜感激,我们很沮丧。

Might be the same problem here. 可能在这里是同样的问题。 I think below link helps you to get more about working with package versions. 我认为以下链接可帮助您获得有关使用软件包版本的更多信息。

as you specified that you have a package.json with a dev dependency of "typescript": ^"2.0.6". 如您所指定的,您有一个package.json ,其dev依赖性为“ typescript”:^“ 2.0.6”。

Just try by replacing the below line in your package.json file. 只需尝试替换package.json文件中的以下行即可。

"typescript": "exact version you needed" “ typescript”:“您需要的确切版本”

Ex. 例如 "typescript": "2.0.6" “ typescript”:“ 2.0.6”

Including with this before running npm install just delete the package-lock.json file from your projects root directory if any. 在运行npm install之前包括此内容,只需从项目根目录中删除package-lock.json文件即可。

Should I manually update dependencies versions in the package.json after creating a new project with npm? 使用npm创建新项目后,是否应该在package.json中手动更新依赖项版本?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM