阅读 npm-json ( npm help json
) 后,我构建了package.json
如下文件:{"name": "app name", "version": "0.1"}
. 该目录具有以下结构:
/
|-- main.js
|-- package.json
我熟悉Node.js - 部署 Node.js 应用程序时是否需要重新安装生产服务器上的所有模块,因此我尝试通过执行安装依赖项npm install moduleDep --save
,但出现以下错误:
0 info it worked if it ends with ok
1 verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'jquery', '--save' ]
2 info using npm@1.2.2
3 info using node@v0.8.18
4 verbose read json /home/roth/develop/build/package.json
5 error Error: invalid version: 1
5 error at validVersion (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:582:40)
5 error at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:342:23)
5 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:140:33
5 error at cb (/usr/local/lib/node_modules/npm/node_modules/slide/lib/async-map.js:48:11)
5 error at /usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:48
5 error at fs.js:117:20
5 error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:53:5
5 error at /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:62:5
5 error at Object.oncomplete (fs.js:297:15)
6 error If you need help, you may report this log at:
6 error <http://github.com/isaacs/npm/issues>
6 error or email it to:
6 error <npm-@googlegroups.com>
7 error System Linux 3.1.10-1.16-desktop
8 error command "node" "/usr/local/bin/npm" "install" "jquery" "--save"
9 error cwd /home/roth/develop/build
10 error node -v v0.8.18
11 error npm -v 1.2.2
12 verbose exit [ 1, true ]
在运行main
模块之前,我必须使用 NPM 来安装依赖项。是否有任何我可以执行的命令将安装然后将依赖项添加到package.json
?一个彻底的解释会很棒。