2017-06-02 44 views
3

我使用git克隆一个项目,该项目是使用ionic 2创建的,但是当我执行重新创建node_modules文件夹的命令时,出现此错误。Npm错误 - 找不到匹配的版本

npm install 
npm WARN deprecated [email protected]: Please update to the latest object-keys 
npm ERR! code ETARGET 
npm ERR! notarget No matching version found for [email protected]^3.5.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 'ionic-hello-world' 
npm ERR! notarget 

npm ERR! A complete log of this run can be found in: 
npm ERR!  /Users/wihermes/.npm/_logs/2017-06-02T13_58_47_295Z-debug.log 

注:我已经更新npm。

有谁知道如何解决它?

+0

同样的问题NPM安装-g离子@ latest'这需要它来v.3.12 .0 ... npm抱怨说“没有找到匹配的版本”,但它显然已安装。努力将'package.json'改为'^ 3.0.0',然后让它安装任何想要的东西。这显然有效,但它只安装了3.10.3。不知道为什么不同,但是meh。 – mc01

回答

6

版本已指定,或你的依赖的一个已经指定不发布到npmjs.com

执行npm view ionic-native(见docs)以下的输出则返回包版本:

versions: 
    [ '1.0.7', 
    '1.0.8', 
    '1.0.9', 
    '1.0.10', 
    '1.0.11', 
    '1.0.12', 
    '1.1.0', 
    '1.1.1', 
    '1.2.0', 
    '1.2.1', 
    '1.2.2', 
    '1.2.3', 
    '1.2.4', 
    '1.3.0', 
    '1.3.1', 
    '1.3.2', 
    '1.3.3', 
    '1.3.4', 
    '1.3.5', 
    '1.3.6', 
    '1.3.7', 
    '1.3.8', 
    '1.3.9', 
    '1.3.10', 
    '1.3.11', 
    '1.3.12', 
    '1.3.13', 
    '1.3.14', 
    '1.3.15', 
    '1.3.16', 
    '1.3.17', 
    '1.3.18', 
    '1.3.19', 
    '1.3.20', 
    '1.3.21', 
    '1.3.22', 
    '1.3.23', 
    '1.3.24', 
    '1.3.25', 
    '1.3.26', 
    '1.3.27', 
    '2.0.0', 
    '2.0.1', 
    '2.0.2', 
    '2.0.3', 
    '2.1.2', 
    '2.1.3', 
    '2.1.4', 
    '2.1.5', 
    '2.1.6', 
    '2.1.7', 
    '2.1.8', 
    '2.1.9', 
    '2.2.0', 
    '2.2.1', 
    '2.2.2', 
    '2.2.3', 
    '2.2.4', 
    '2.2.5', 
    '2.2.6', 
    '2.2.7', 
    '2.2.8', 
    '2.2.9', 
    '2.2.10', 
    '2.2.11', 
    '2.2.12', 
    '2.2.13', 
    '2.2.14', 
    '2.2.15', 
    '2.2.16', 
    '2.2.17', 
    '2.3.0', 
    '2.3.1', 
    '2.3.2', 
    '2.4.0', 
    '2.4.1', 
    '2.5.0', 
    '2.5.1', 
    '2.6.0', 
    '2.7.0', 
    '2.8.0', 
    '2.8.1', 
    '2.9.0' ], 

正如你所看到的,没有比2.9.0更高的版本发布到npm仓库。奇怪的是,他们的版本高于GitHub。我会建议opening an issue with the maintainers on this

现在你可以manually install the package via the tarball URL of the required release

npm install https://github.com/ionic-team/ionic-native/tarball/v3.5.0 
+0

谢谢我会报告这个 –

1

尝试后`去除包lock.json文件第一现在

+0

这根本就没有解决办法!删除锁定文件就像将大多数软件包更新为最新的已知版本。在最糟糕的情况下,您的项目中没有测试。然后你必须手动检查每个小功能来验证一切仍然正常工作。 – Chilian

+0

这工作对我来说,当我改变'package.json'中的'name'后, –