0

我已经安装了 nodejs,我已经在 ubuntu virtualbox 上安装了 gcc、python 等。node.js 工作正常。

在使用 npm 安装 mechanize 或zombiejs 模块时,我遇到了这些奇怪的错误。帮我解决这个谢谢。

我正在使用这些命令来安装模块。

sudo npm 安装僵尸。

npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
gyp: /home/khushal/.node-gyp/0.10.18/common.gypi not found (cwd: /home/khushal/node_modules/zombie/node_modules/jsdom/node_modules/contextify) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.2.0-23-generic-pae
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/khushal/node_modules/zombie/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok 
npm http 200 https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.1.tgz
npm ERR! Error: ENOENT, lstat '/home/khushal/node_modules/zombie/node_modules/html5/data/tree-construction/tests19.dat-25/result.tree'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "zombie"
npm ERR! cwd /home/khushal
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/khushal/node_modules/zombie/node_modules/html5/data/tree-construction/tests19.dat-25/result.tree
npm ERR! fstream_path /home/khushal/node_modules/zombie/node_modules/html5/data/tree-construction/tests19.dat-25/result.tree
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, chown '/home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "zombie"
npm ERR! cwd /home/khushal
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
npm ERR! fstream_path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "zombie"
npm ERR! cwd /home/khushal
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
npm ERR! fstream_path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm http 304 https://registry.npmjs.org/delayed-stream/0.0.5
npm ERR! weird error 1
npm ERR! Error: ENOENT, chown '/home/khushal/tmp/npm-2174-Ll1tUpTG/1379314549896-0.5816432405263186/package/LICENSE'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "zombie"
npm ERR! cwd /home/khushal
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/khushal/tmp/npm-2174-Ll1tUpTG/1379314549896-0.5816432405263186/package/LICENSE
npm ERR! fstream_path /home/khushal/tmp/npm-2174-Ll1tUpTG/1379314549896-0.5816432405263186/package/LICENSE
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chown
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:305:19
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:133:7
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: ENOENT, lstat '/home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.2.0-23-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "zombie"
npm ERR! cwd /home/khushal
npm ERR! node -v v0.10.18
npm ERR! npm -v 1.3.8
npm ERR! path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
npm ERR! fstream_path /home/khushal/node_modules/zombie/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/khushal/npm-debug.log
npm ERR! not ok code 0
4

1 回答 1

0

注册表 URL 指向 https,试试这个

npm config set registry="http://registry.npmjs.org/"

然后尝试安装模块。您使用的代理可能会阻止安全 (https) 连接。

于 2013-11-20T10:33:29.350 回答