gem:找不到命令

时间:2015-05-02 05:20:10

标签: ruby rubygems docker

我有bash文件,用于构建gem文件并启动我的程序:

cd /src/stackify-api
rm *.gem
gem build stackify.gemspec
gem install stackify-0.1.0.gem

cd /src/stackify-classificator
rm *.gem
gem build stackify-classificator.gemspec
gem install stackify-classificator-0.1.1.gem

cd /src/bin
ruby console-task.rb

我在docker容器中使用它。如果我以交互方式启动容器并手动运行此bash文件,它可以正常工作:

 ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash              
root@898cec6a7d85:/# /src/build.sh 
  ...
  Successfully built RubyGem
  Name: stackify
  Version: 0.1.0
  File: stackify-0.1.0.gem

但是当我尝试在Docker中启动此脚本时,我收到错误消息:

 ~ » docker run -it -v /mnt/lacie/online/btsync/development:/src stack_rvm /bin/bash /src/build.sh
/src/build.sh: line 5: gem: command not found

为什么以及如何解决?

2 个答案:

答案 0 :(得分:1)

我找到了答案 - 使用npm ERR! enoent npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path C:\projects\meanapp\client\node_modules\grunt-contrib-imagemin\nod e_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_mod ules\bin-wrapper\node_modules\lnfs\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! enoent ENOENT, open 'C:\projects\meanapp\client\node_modules\grunt-cont rib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\g ifsicle\node_modules\bin-wrapper\node_modules\lnfs\package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path C:\projects\meanapp\client\node_modules\grunt-contrib-imagemin\nod e_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_mod ules\bin-wrapper\node_modules\globby\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! enoent ENOENT, open 'C:\projects\meanapp\client\node_modules\grunt-cont rib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\g ifsicle\node_modules\bin-wrapper\node_modules\globby\package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path C:\projects\meanapp\client\node_modules\grunt-contrib-imagemin\nod e_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle\node_mod ules\bin-wrapper\node_modules\os-filter-obj\package.json npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! enoent ENOENT, open 'C:\projects\meanapp\client\node_modules\grunt-cont rib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\g ifsicle\node_modules\bin-wrapper\node_modules\os-filter-obj\package.json' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\optimis t\0.6.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\is-utf8 \0.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\first-c hunk-stream\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\exec-se ries\1.0.1\package.tgz npm WARN optional dep failed, continuing imagemin-svgo@4.1.2 npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\archive -type\2.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\figures \1.3.5\package.tgz npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path C:\projects\meanapp\client\node_modules\grunt-contrib-imagemin\nod e_modules\imagemin\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\g lob2base\README.md npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! enoent ENOENT, open 'C:\projects\meanapp\client\node_modules\grunt-cont rib-imagemin\node_modules\imagemin\node_modules\vinyl-fs\node_modules\glob-strea m\node_modules\glob2base\README.md' npm ERR! enoent This is most likely not a problem with npm itself npm ERR! enoent and is related to npm not being able to find a file. npm ERR! enoent npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lnfs\1. 0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\is-path -global\1.0.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\bin-che ck\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lnfs\1. 0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\bin-che ck\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\is-path -global\1.0.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lazy-re q\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\bin-ver sion-check\2.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\tempfil e\1.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\tempfil e\1.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\url-reg ex\2.1.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\tempfil e\1.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\clean-c ss\3.1.9\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\tempfil e\1.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\glob\4. 5.3\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\squeak\ 1.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\squeak\ 1.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\unique- stream\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\squeak\ 1.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\globby\ 1.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\globby\ 1.2.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\4.1.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\decompr ess\2.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\decompr ess\2.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\decompr ess\2.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\decompr ess\2.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\bin-che ck\1.0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\ordered -read-streams\0.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\js-yaml \2.0.5\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\downloa d\3.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\source- map\0.3.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\undersc ore.string\2.2.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\readabl e-stream\1.0.33\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\async\0 .1.15\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\ng-anno tate\0.15.4\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\readabl e-stream\1.1.13\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\glob\4. 5.3\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\uglify- js\2.4.20\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\minimat ch\0.2.14\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\browser ify-zlib\0.1.4\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\glob\3. 2.11\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\browser ify-zlib\0.1.4\package.tgz npm WARN optional dep failed, continuing imagemin-pngquant@4.1.0 npm WARN optional dep failed, continuing imagemin-jpegtran@4.1.0 npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\readabl e-stream\1.1.13\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\readabl e-stream\1.1.13\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 0.9.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\log-sym bols\1.0.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\chalk\1 .0.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\pretty- bytes\1.0.4\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\each-as ync\1.1.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\coffee- script\1.3.3\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\brace-e xpansion\1.1.0\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\jshint\ 2.7.0\package.tgz npm WARN optional dep failed, continuing imagemin-optipng@4.2.0 npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\iconv-l ite\0.2.11\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\svgo\0. 5.1\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 2.4.2\package.tgz npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\lodash\ 1.0.2\package.tgz npm WARN optional dep failed, continuing fsevents@0.3.5 npm ERR! tar.unpack untar error C:\Users\Rahul\AppData\Roaming\npm-cache\cdnjs-c dn-data\0.1.1\package.tgz / > phantomjs@1.9.16 install C:\projects\meanapp\client\node_modules\karma-phantom js-launcher\node_modules\phantomjs > node install.js npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path C:\projects\meanapp\client\node_modules\grunt-contrib-watch\node_m odules\lodash\lodash.js npm ERR! code EPERM npm ERR! errno -4048 npm ERR! Error: EPERM, unlink 'C:\projects\meanapp\client\node_modules\grunt-con trib-watch\node_modules\lodash\lodash.js' npm ERR! at Error (native) npm ERR! { [Error: EPERM, unlink 'C:\projects\meanapp\client\node_modules\grunt -contrib-watch\node_modules\lodash\lodash.js'] npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! path: 'C:\\projects\\meanapp\\client\\node_modules\\grunt-contrib-wat ch\\node_modules\\lodash\\lodash.js' } npm ERR! npm ERR! Please try running this command again as root/Administrator. Download already available at C:\Users\Rahul\AppData\Local\Temp\phantomjs\phanto mjs-1.9.8-windows.zip Extracting zip contents \ Please include the following file with any support request: npm ERR! C:\projects\meanapp\client\npm-debug.log grunt-cli: The grunt command line interface. (v0.1.13) Fatal error: Unable to find local grunt. If you're seeing this message, either a Gruntfile wasn't found or grunt hasn't been installed locally to your project. For more information about installing and configuring grunt, please see the Getting Started guide: http://gruntjs.com/getting-started Removing C:\projects\meanapp\client\node_modules\karma-phantomjs-launcher\node_m odules\phantomjs\lib\phantom Copying extracted folder C:\Users\Rahul\AppData\Local\Temp\phantomjs\phantomjs-1 .9.8-windows.zip-extract-1430549417367\phantomjs-1.9.8-windows -> C:\projects\me anapp\client\node_modules\karma-phantomjs-launcher\node_modules\phantomjs\lib\ph antom Writing location.js file Done. Phantomjs binary available at C:\projects\meanapp\client\node_modules\karm a-phantomjs-launcher\node_modules\phantomjs\lib\phantom\phantomjs.exe - > ws@0.4.32 install C:\projects\meanapp\client\node_modules\karma\node_modules\s ocket.io\node_modules\socket.io-client\node_modules\ws > (node-gyp rebuild 2> builderror.log) || (exit 0) C:\projects\meanapp\client\node_modules\karma\node_modules\socket.io\node_module s\socket.io-client\node_modules\ws>if not defined npm_config_node_gyp (node "C:\ Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node- gyp\bin\node-gyp.js" rebuild ) else (rebuild) npm ERR! Please include the following file with any support request: npm ERR! C:\projects\meanapp\client\npm-debug.log

-c -l

答案 1 :(得分:1)

对我来说,在Ruby安装过程中,C:\ Ruby24-x64 \ bin被添加到Path用户变量而不是Path系统变量。一旦我将C:\ Ruby24-x64 \ bin添加到Path系统变量,一切正常。