使用mup deploy
部署流星应用程序时出错,实际上,当我手动尝试使用mup生成的Dockerfile构建映像时,我也会收到此错误。
我猜主要的错误信息(日志输出中的某个地方)是:
sh:1:node-pre-gyp:not found
docker build -t my-app:build .
的日志输出:
Removing intermediate container 3ac4d1150023
Step 7/7 : RUN cd /built_app/programs/server && npm install --unsafe-perm
---> Running in 4a6faacefc21
> fibers@1.0.13 install /built_app/programs/server/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-v8-4.5` exists; testing
Binary is fine; exiting
> meteor-dev-bundle@0.0.0 install /built_app/programs/server
> node npm-rebuild.js
> bcrypt@0.8.6 install /built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt
> node-gyp rebuild
make: Entering directory '/built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build'
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
COPY Release/bcrypt_lib.node
make: Leaving directory '/built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/build'
bcrypt@0.8.6 /built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt
bindings@1.2.1 /built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/node_modules/bindings
nan@2.2.1 /built_app/programs/server/npm/node_modules/meteor/npm-bcrypt/node_modules/bcrypt/node_modules/nan
> bcrypt@1.0.3 install /built_app/programs/server/npm/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
sh: 1: node-pre-gyp: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the bcrypt@1.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-07T17_21_17_486Z-debug.log
npm WARN meteor-dev-bundle@0.0.0 No description
npm WARN meteor-dev-bundle@0.0.0 No repository field.
npm WARN meteor-dev-bundle@0.0.0 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-dev-bundle@0.0.0 install: `node npm-rebuild.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@0.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-02-07T17_21_17_559Z-debug.log
The command '/bin/sh -c cd /built_app/programs/server && npm install --unsafe-perm' returned a non-zero code: 1
上面提到的日志文件说:
...
1227 info build /built_app/programs/server/npm/node_modules/bcrypt
1228 info lifecycle bcrypt@1.0.3~preinstall: bcrypt@1.0.3
1229 silly lifecycle bcrypt@1.0.3~preinstall: no script for preinstall, continuing
1230 info linkStuff bcrypt@1.0.3
1231 silly linkStuff bcrypt@1.0.3 has /built_app/programs/server/npm/node_modules as its parent node_modules
1232 verbose linkBins bcrypt@1.0.3
1233 verbose linkMans bcrypt@1.0.3
1234 verbose rebuildBundles bcrypt@1.0.3
1235 info lifecycle bcrypt@1.0.3~install: bcrypt@1.0.3
1236 verbose lifecycle bcrypt@1.0.3~install: unsafe-perm in lifecycle true
1237 verbose lifecycle bcrypt@1.0.3~install: PATH: /opt/nodejs/lib/node_modules/npm/bin/node-gyp-bin:/built_app/programs/server/npm/node_modules/bcrypt/node_modules/.bin:/built_app/programs/server/npm/node_modules/.bin:/opt/nodejs/bin:/opt/nodejs/lib/node_modules/npm/bin/node-gyp-bin:/built_app/programs/server/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1238 verbose lifecycle bcrypt@1.0.3~install: CWD: /built_app/programs/server/npm/node_modules/bcrypt
1239 silly lifecycle bcrypt@1.0.3~install: Args: [ '-c', 'node-pre-gyp install --fallback-to-build' ]
1240 info lifecycle bcrypt@1.0.3~install: Failed to exec install script
1241 verbose stack Error: bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
1241 verbose stack spawn ENOENT
1241 verbose stack at ChildProcess.<anonymous> (/opt/nodejs/lib/node_modules/npm/lib/utils/spawn.js:33:16)
1241 verbose stack at emitTwo (events.js:87:13)
1241 verbose stack at ChildProcess.emit (events.js:172:7)
1241 verbose stack at maybeClose (internal/child_process.js:862:16)
1241 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:222:5)
1242 verbose pkgid bcrypt@1.0.3
1243 verbose cwd /built_app/programs/server/npm
1244 verbose Linux 4.4.0-83-generic
1245 verbose argv "/opt/nodejs/bin/node" "/opt/nodejs/bin/npm" "rebuild"
1246 verbose node v4.8.7
1247 verbose npm v4.6.1
1248 error file sh
1249 error code ELIFECYCLE
1250 error errno ENOENT
1251 error syscall spawn
1252 error bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
1252 error spawn ENOENT
1253 error Failed at the bcrypt@1.0.3 install script.
1253 error This is probably not a problem with npm. There is likely additional logging output above.
1254 verbose exit [ 1, true ]
流星版:1.4.4.2 任何想法......?
找不到哪个文件?
(并且,我非常确定在一段时间之前完全相同的配置工作......)
我真的很感激任何建议!
答案 0 :(得分:2)
由于node-pre-gyp
包
bcrypt
&GT; bcrypt@1.0.3 install / built_app / programs / server / npm / node_modules / bcrypt
&GT; node-pre-gyp install --fallback-to-build
但是,如果你密切关注,你会注意到上面还安装了bcrypt
的另一个版本并成功构建:
&GT; bcrypt@0.8.6 install / built_app / programs / server / npm / node_modules / meteor / npm -bcrypt / node_modules / bcrypt
&GT; node-gyp rebuild
考虑到安装路径,似乎0.8.6
可能来自Meteor Atmosphere包(npm-bcrypt
),而1.0.3
来自package.json
依赖项。
因此,您可能应首先尝试解决为什么您有两个不同的bcrypt
安装,以及是否可以摆脱1.0.3
版本。
最有可能的情况是,由于Meteor的bcrypt
软件包,您的应用依赖accounts-password
,后者将自动使用JavaScript版bcrypt
,如果是缺少,所以你的应用程序不应该只是删除npm版本:meteor npm uninstall --save bcrypt
(如@AbhishekMaurya所述)。但是,正如@ AbhishekMaurya的回答所述,应用程序启动日志将显示一条警告消息,建议npm install bcrypt
(您刚刚撤消)。如果您的应用使用bcrypt
的JavaScript实现时接受性能略有下降,则可以接受该警告。
至于现在的根本原因,有a bug in Meteor阻止了node-pre-gyp
对npm
可见。这应该已在Meteor版本1.4.3
中修复。
如果没有,您可以尝试确保使用&#34; old&#34; bcrypt
的{{1}}版本,here:meteor npm install --save bcrypt@0.8.7
答案 1 :(得分:1)
卸载bcrypt,您会看到警告但对应用程序没有重大影响。