我正在尝试使用elastic-beanstalk作为容器命令执行当前的npm bin,但是出现以下错误:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'bin' ]
2 info using npm@5.6.0
3 info using node@v8.11.3
4 verbose stack TypeError: Cannot read property 'split' of undefined
4 verbose stack at /usr/lib/node_modules/npm/node_modules/osenv/osenv.js:60:29
4 verbose stack at Object.exports.(anonymous function) [as path] (/usr/lib/node_modules/npm/node_modules/osenv/osenv.js:15:15)
4 verbose stack at EventEmitter.bin (/usr/lib/node_modules/npm/lib/bin.js:15:20)
4 verbose stack at Object.commandCache.(anonymous function) (/usr/lib/node_modules/npm/lib/npm.js:159:13)
4 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/bin/npm-cli.js:84:30)
4 verbose stack at _combinedTickCallback (internal/process/next_tick.js:131:7)
4 verbose stack at process._tickCallback (internal/process/next_tick.js:180:9)
5 verbose cwd /var/app/ondeck/application
6 verbose Linux 4.14.47-56.37.amzn1.x86_64
7 verbose argv "/usr/bin/node" "/usr/bin/npm" "bin"
8 verbose node v8.11.3
9 verbose npm v5.6.0
10 error Cannot read property 'split' of undefined
11 verbose exit [ 1, true ]
当我从终端执行它时,一切正常,我将获得~/node_modules/.bin/
目录。
有什么想法吗?
谢谢!
答案 0 :(得分:0)
我必须在执行之前添加路径:
export PATH=$PATH:$(pwd)/node_modules/.bin
npm bin
谢谢!