我有一台本地机器和一台服务器。在我的本地更新 npm 时,我有以下版本:
myaccount@local:$ npm -v
3.8.5
但是在服务器上:
myaccount@server:$ npm -v
2.1.11
还有什么,我尝试使用async
将npm install --save async
模块添加到 NodeJS 项目中,并将以下依赖项添加到我的本地:
{
...,
"dependencies": {
"async": "^2.0.0-rc.2",
...
// Other dependencies
}
}
但是当我尝试在我的服务器上获取它时:
myaccount@server:/path/to/my/project$ npm install
npm WARN package.json crypto@0.0.3 crypto is also the name of a node core module.
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/bin/npm" "install"
npm ERR! node v0.10.41
npm ERR! npm v2.1.11
npm ERR! code ETARGET
npm ERR! notarget No compatible version found: async@'>=2.0.0-rc.2 <3.0.0'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["0.1.0","0.1.1","0.1.2","0.1.3","0.1.4","0.1.5","0.1.6","0.1.7","0.1.8","0.1.9","0.1.10","0.1.11","0.1.12","0.1.13","0.1.14","0.1.15","0.1.16","0.1.17","0.1.18","0.1.19","0.1.20","0.1.21","0.1.22","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.2.8","0.2.9","0.2.10","0.3.0","0.4.0","0.4.1","0.5.0","0.6.0","0.6.1","0.6.2","0.7.0","0.8.0","0.9.0"]
npm ERR! notarget
npm ERR! notarget This is most likely not a problem with npm itself.
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! Please include the following file with any support request:
npm ERR! /home/certidev/apps/web-crawler/npm-debug.log
所以,似乎我的 npm 在一个过时的地方读取它的依赖关系,就像那样。我是 npm 和 NodeJS 的新手,所以我不确定发生了什么。
我该如何解决?如果需要,我准备好npm-debug.log
文件。
修改
我的 NodeJS 版本。当地:
myaccount@local:$ nodejs -v
v0.10.37
服务器:
myaccount@server:$ nodejs -v
v0.10.41