rauchg / slackin

Public Slack organizations made easy
http://rauchg.com/slackin/
MIT License
6.51k stars 1.35k forks source link

Docker: The command '/bin/sh -c npm install --unsafe-perm' returned a non-zero code: 47 #209

Open loretoparisi opened 8 years ago

loretoparisi commented 8 years ago

The docker build ends up with

macbookproloreto:slackin admin$ docker build .
Sending build context to Docker daemon 689.7 kB
Step 1 : FROM octohost/nodejs
latest: Pulling from octohost/nodejs

a3ed95caeb02: Pull complete 
3b1d42cd9af9: Pull complete 
707a1369b69a: Pull complete 
2dcca790c489: Pull complete 
72f27bdd9cd9: Pull complete 
016c68161ff9: Pull complete 
395900179555: Pull complete 
3457093fdb7a: Pull complete 
Digest: sha256:fef926ef5aa30b2ce408bf5fc6d08d05c0ab0c01f90a9feea0a5d44e28c54d0b
Status: Downloaded newer image for octohost/nodejs:latest
 ---> 13d646772012
Step 2 : ENV PORT 3000
 ---> Running in 0a7011ef3f2e
 ---> 53885c18c08e
Removing intermediate container 0a7011ef3f2e
Step 3 : ADD . /srv/www
 ---> 12bfce395eaf
Removing intermediate container ffc7c39793df
Step 4 : WORKDIR /srv/www
 ---> Running in ef7e11533f27
 ---> 8fdc3ae6ea3a
Removing intermediate container ef7e11533f27
Step 5 : RUN npm install --unsafe-perm
 ---> Running in 320379027ec0
npm WARN engine args@1.2.1: wanted: {"node":">= 4.0.0"} (current: {"node":"0.10.35","npm":"1.4.28"})
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash@2.4.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm ERR! EEXIST, open '/root/.npm/306ea9b9-ot-npm-lodash-4-13-1-package-tgz.lock'
File exists: /root/.npm/306ea9b9-ot-npm-lodash-4-13-1-package-tgz.lock
Move it away, and try again. 

npm ERR! System Linux 4.4.13-moby
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "--unsafe-perm"
npm ERR! cwd /srv/www
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! path /root/.npm/306ea9b9-ot-npm-lodash-4-13-1-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
npm ERR! not ok code 0
The command '/bin/sh -c npm install --unsafe-perm' returned a non-zero code: 47
loretoparisi commented 8 years ago

[UPDATE] Changing the FROM to FROM mhart/alpine-node:4.4.5 it worked.

adamkdean commented 8 years ago

Perhaps this is linked to an issue I had yesterday: https://github.com/sass/node-sass/issues/1621#issuecomment-230112175? npm 2.x not liking --unsafe-perm but npm 3.x working fine?

Update: nope. Even with npm 3.x installed, npm install -g slackin fails in a container.

> slackin@0.8.3 postinstall /usr/local/lib/node_modules/slackin
> gulp

[15:45:16] Requiring external module babel-core/register
[15:45:17] Using gulpfile /usr/local/lib/node_modules/slackin/gulpfile.babel.js
fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: EACCES: permission denied, open '/root/.babel.json'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.writeFileSync (fs.js:1156:15)
    at save (/usr/local/lib/node_modules/slackin/node_modules/babel-register/lib/cache.js:57:40)
    at nextTickCallbackWith0Args (node.js:419:9)
    at process._tickCallback (node.js:348:13)
npm info lifecycle slackin@0.8.3~postinstall: Failed to exec postinstall script
/usr/local/lib
`-- (empty)

npm ERR! Linux 3.13.0-79-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "slackin"
npm ERR! node v4.2.6
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! slackin@0.8.3 postinstall: `gulp`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the slackin@0.8.3 postinstall script 'gulp'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the slackin package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs slackin
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls slackin
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log
npm ERR! code 1
adamkdean commented 8 years ago

Even updating this to alpine-node, it's still broken:

Sending build context to Docker daemon 545.6 kB
Sending build context to Docker daemon 588.8 kB
Sending build context to Docker daemon 588.8 kB

Step 1 : FROM mhart/alpine-node:4.4.5
 ---> 523acbf035ed
Step 2 : ENV PORT 3000
 ---> Using cache
 ---> f83f2423f0f6
Step 3 : ADD . /srv/www
 ---> f3a0eb86c358
Removing intermediate container 7d03166b9956
Step 4 : WORKDIR /srv/www
 ---> Running in d3668abb5250
 ---> ea6cf392b6ca
Removing intermediate container d3668abb5250
Step 5 : RUN npm install --unsafe-perm
 ---> Running in 68a5d6e5184a
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@3.0.8: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated lodash@2.4.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
Killed
The command '/bin/sh -c npm install --unsafe-perm' returned a non-zero code: 137
Build step 'Execute shell' marked build as failure
Finished: FAILURE

Notice it says Killed in there? I wonder if something is killing the build process, due perhaps to low memory? Will investigate.

adamkdean commented 8 years ago

Ok ignore me, my issue is out-of-memory. The docker build takes up > 800 MB of memory.