将节点6.10.3安装为NPM依赖项

时间:2017-09-15 21:23:58

标签: node.js npm aws-lambda dependency-management

使用要部署到serverless frameworkAWS Lambda处理项目,我希望运行与available on AWS Lambda相同的节点版本 - 即节点6.10.3。将其添加到"engines"无效,因此我也将其添加到"dependencies",但安装该依赖项始终失败:

> node@6.10.3 preinstall /Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/node
> node installArchSpecificPackage

npm ERR! code ETARGET
npm ERR! notarget No matching version found for node-darwin-x64@6.10.3
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! A complete log of this run can be found in:
npm ERR!     /Users/ssterling3/.npm/_logs/2017-09-15T20_58_25_281Z-debug.log
module.js:471
    throw err;
    ^

Error: Cannot find module 'node-darwin-x64/package.json'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.resolve (internal/module.js:27:19)
    at ChildProcess.<anonymous> (/Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/node-bin-setup/index.js:18:27)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@6.10.3 preinstall: `node installArchSpecificPackage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node@6.10.3 preinstall 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!     /Users/ssterling3/.npm/_logs/2017-09-15T20_58_25_350Z-debug.log

这似乎是最新日志文件的相关部分:

59 silly preinstall node@6.10.3
60 info lifecycle node@6.10.3~preinstall: node@6.10.3
61 verbose lifecycle node@6.10.3~preinstall: unsafe-perm in lifecycle true
62 verbose lifecycle node@6.10.3~preinstall: PATH: /opt/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/node/node_modules/.bin:/Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/usr/local/munki:/Users/ssterling3/bin:/opt/local/bin/:/Users/ssterling3/.npm-global/bin/:/Users/ssterling3/.gem/ruby/2.4.0/bin/
63 verbose lifecycle node@6.10.3~preinstall: CWD: /Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/node
64 silly lifecycle node@6.10.3~preinstall: Args: [ '-c', 'node installArchSpecificPackage' ]
65 silly lifecycle node@6.10.3~preinstall: Returned: code: 1  signal: null
66 info lifecycle node@6.10.3~preinstall: Failed to exec preinstall script
67 verbose unlock done using /Users/ssterling3/.npm/_locks/staging-9795425667a03fed.lock for /Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard/node_modules/.staging
68 verbose stack Error: node@6.10.3 preinstall: `node installArchSpecificPackage`
68 verbose stack Exit status 1
68 verbose stack     at EventEmitter.<anonymous> (/opt/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
68 verbose stack     at emitTwo (events.js:106:13)
68 verbose stack     at EventEmitter.emit (events.js:191:7)
68 verbose stack     at ChildProcess.<anonymous> (/opt/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
68 verbose stack     at emitTwo (events.js:106:13)
68 verbose stack     at ChildProcess.emit (events.js:191:7)
68 verbose stack     at maybeClose (internal/child_process.js:886:16)
68 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
69 verbose pkgid node@6.10.3
70 verbose cwd /Users/ssterling3/Documents/2017/IIT/Apps/Student Dashboard/mobile-dashboard
71 verbose Darwin 16.7.0
72 verbose argv "/opt/local/bin/node" "/opt/local/bin/npm" "install" "node@6.10.3"
73 verbose node v6.10.3
74 verbose npm  v5.4.0
75 error code ELIFECYCLE
76 error errno 1
77 error node@6.10.3 preinstall: `node installArchSpecificPackage`
77 error Exit status 1
78 error Failed at the node@6.10.3 preinstall script.
78 error This is probably not a problem with npm. There is likely additional logging output above.
79 verbose exit [ 1, true ]

看起来它正在尝试获取程序包的特定于平台的变体,而服务器没有它。

没有其他依赖项(或devDependencies)受到影响。

这是在macOS Sierra 10.12.6(16G29)上,MacPorts 2.4.1,macports nodejs6 @ 6.10.3_0,以及macports npm5 @ 5.4.0_0。

  • npmjs.com真的没有匹配版本吗?
  • 是否可以从其他来源获得?
  • 我可以采取哪些措施来帮助npmjs.com提供帮助吗?

1 个答案:

答案 0 :(得分:2)

联系维护者后,现在存在npm包node-darwin-x64@6.10.3,这解决了问题。

(Lambda现在也支持节点8.10.0,相应的node-darwin-x64@8.10.0也存在。)