【发布时间】:2016-05-28 06:04:08
【问题描述】:
我有一些 npm 包的各种权限和/或路径问题,这次是部署的 dpd 二进制文件。然而,它似乎仍然与我不时收到的任何其他熟悉的令人沮丧的 npm 路径问题有关。考虑到我经常使用 -g 而不是在安装 npm 包时,它似乎是 npm 使用的熟悉面孔。..
到目前为止,为了解决它,我尝试从用户和全球范围内多次重新安装 deploy 和 mongodb,我什至重新安装了 npm。我在运行 dpd 时遇到一致的包错误。我发现很多相关的,但没有一个有效。这是我今天运行 dpd 时的问题。有什么好建议吗?
当从 linux 运行时,我如下 $ dpd 开始部署 v0.8.4... 无法启动 MongoDB(确保 'mongod' 在您的 $PATH 中或使用 dpd --mongod 选项。参考:http://docs.deployd.com/docs/basics/cli.html) 再见
$ sudo dpd
starting deployd v0.8.4...
Failed to start MongoDB (Make sure 'mongod' are in your $PATH or use dpd --mongod option. Ref: http://docs.deployd.com/docs/basics/cli.html)
bye
$ dpd --mongod ./.dpd/pids
starting deployd v0.8.4...
child_process.js:1162
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1162:11)
at exports.spawn (child_process.js:995:9)
at Object.exports.restart (/usr/bin/node_modules/bin/lib/node_modules/deployd/lib/util/mongod.js:38:14)
at start (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:149:16)
at Object.<anonymous> (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:280:31)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
即使我运行它 sudo 我也会遇到同样的错误。
$ sudo dpd --mongod ./.dpd/pids
starting deployd v0.8.4...
child_process.js:1162
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1162:11)
at exports.spawn (child_process.js:995:9)
at Object.exports.restart (/usr/bin/node_modules/bin/lib/node_modules/deployd/lib/util/mongod.js:38:14)
at start (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:149:16)
at Object.<anonymous> (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:280:31)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
当从 samba 共享映射网络驱动器上的 windows 运行时,我得到了这个
dpd > fs: missing callback Error: EPERM, open 'C:\Program Files (x86)\Deployd\node_modules\deployd\.latestversion'
我在这里做错了什么?
我找不到这个文件,也找不到这行代码, child_process.js:1162 抛出 errnoException(err, 'spawn'); 当我为它使用 grep 时,确实出现了代码行的一个引用,即 /bin/node,当我在 vim 中打开它时,它看起来是加密的……我想再看一遍,那行可能就在那里。 .. 嗯。
好的,我确实在节点二进制本身中找到了该行,
this.spawnfile = options.file;
var err = this._handle.spawn(options);
// Run-time errors should emit an error, not throw an exception. if (err === uv.UV_EAGAIN ||
err === uv.UV_EMFILE ||
err === uv.UV_ENFILE ||
err === uv.UV_ENOENT) {
process.nextTick(function() {
self._handle.onexit(err);
});
// There is no point in continuing when we've hit EMFILE or ENFILE
// because we won't be able to set up the stdio file descriptors.
// It's kind of silly that the de facto spec for ENOENT (the test suite)
// mandates that stdio _is_ set up, even if there is no process on the
// receiving end, but it is what it is.
if (err !== uv.UV_ENOENT) return err; } else if (err) {
// Close all opened fds on error
stdio.forEach(function(stdio) {
if (stdio.type === 'pipe') {
stdio.handle.close();
}
});
this._handle.close();
this._handle = null;
throw errnoException(err, 'spawn'); }
这是某种疯狂的权限错误吗?我想我将所有文件设置为 755,并且在以用户身份运行时也设置为 dirs.. 没有安装 selinux,可能有一些 facls...怀疑它,在这个目录中..
我重新安装了 npm 和 nodejs,但没有帮助。这是在一个拱形的 linux 盒子上。
编辑:是的,由于某种原因,这也不起作用,即使我通过更正权限问题解决了另一个问题。
$ dpd -d --mongod /usr/bin/node_modules/bin/lib/node_modules
starting deployd v0.8.4...
deployd v0.8.5 is available.
child_process.js:1162
throw errnoException(err, 'spawn');
^
Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1162:11)
at exports.spawn (child_process.js:995:9)
at Object.exports.restart (/usr/bin/node_modules/bin/lib/node_modules/deployd/lib/util/mongod.js:38:14)
at start (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:149:16)
at Object.<anonymous> (/usr/bin/node_modules/bin/lib/node_modules/deployd/bin/dpd:280:31)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
【问题讨论】:
-
您确定 ./.dpd/pid 是您的 mongo 安装所在的目录吗?你应该可以使用'sudo dpd -m /path/to/mongo'。
-
是的,我发现了问题,见下文。
-
另一件事我没有意识到,也没有文档,我没有通过 putty 为我的 ssh 设置任何 X 显示,所以 dpd -d 无法启动浏览器我的win box通过putty使用终端。因此,我不得不使用 doc(ugh) 安装 Windows,这很痛苦,以使仪表板网页通过终端加载。所以它使用我的windows盒子作为本地主机,理想情况下我会在我的linux盒子上利用我已经设置的灯堆栈apache服务器,我用它来开发我通过putty访问的......
-
也在那个 mongodb 上,这很有趣,因为对于彼此的 npm 包,安装了一个具有相同名称的二进制文件,例如dpd 用于部署,但对于 mongo,我认为没有安装可以通过路径访问的二进制文件。它是一个数据库,我认为访问方式不同。所以我一开始在高处和低处搜索路径,整个系统上唯一在其文件名中包含“mongod”的东西就是那个。我希望能够简单地将二进制文件添加到我的路径中,就像所有其他 npm 安装一样..
-
好吧,我现在看到了,/usr/bin/node_modules/bin/lib/node_modules/mongodb 所以我也可以使用那个...是的。更新了 OP,对此进行了编辑..