天天看點

dockercompose up build fail (node no such file or directory packages.json )

docker建構項目遇到如下問題:
           
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/lib/node_modules/iojs-bin/node_modules/iojs-darwin-x64/iojs-v3.3.0-darwin-x64/bin/iojs" "/usr/local/bin/npm" "i"
npm ERR! node v3.3.0
npm ERR! npm  v3.3.3
npm ERR! path /Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT:           
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/lib/node_modules/iojs-bin/node_modules/iojs-darwin-x64/iojs-v3.3.0-darwin-x64/bin/iojs" "/usr/local/bin/npm" "i"
npm ERR! node v3.3.0
npm ERR! npm  v3.3.3
npm ERR! path /Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache' -> '/Users/aredridel/Projects/npm/newww/node_modules/inert/node_modules/lru-cache'
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! Please include the following file with any support request:
npm ERR!     /Users/aredridel/Projects/npm/newww/npm-debug.log           
, rename '/Users/aredridel/Projects/npm/newww/node_modules/hapi/node_modules/inert/node_modules/lru-cache' -> '/Users/aredridel/Projects/npm/newww/node_modules/inert/node_modules/lru-cache' 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! Please include the following file with any support request: npm ERR! /Users/aredridel/Projects/npm/newww/npm-debug.log


solve method: the path fo source not mount  volumes  correctly . use  kitematice and select the right path
這裡的找不到packages.json 和找不到代碼路徑有關,主要問題在于kitematic 的版本可能無法識别 docker的compose 檔案中mount路徑,需要手動挂載項目路徑到 volumns 下

挂載到目錄後遇到 找不到express 的錯誤,           

此時,kitematic 管理器中可以使用exec 控制台,進入路徑後執行 npm install  --save 

other question: windows  上docker 預設 default ip 192.168.99.100,如何修改ip:

 a current workaround, assuming you've got the Toolbox installed:

Close Kitematic

Delete the current default VM: docker-machine rm -f default

Create a new default machine docker-machine create -d virtualbox --virtualbox-hostonly-cidr "

192.168.99.1/24"

Open Kitematic and it should be using this VM.

這個方案是先停掉kitematic,然後用docker-machine删除預設的vm執行個體,重新建立一個vm,指定ip,然後啟動kitematic,剛建立的就可以自動識别了