AdapterJS icon indicating copy to clipboard operation
AdapterJS copied to clipboard

Error installing adapterjs on AWS

Open zdila opened this issue 8 years ago • 3 comments

Since version 0.14 we are getting error when deploying our app on AWS:

  > [email protected] postinstall /tmp/deployment/application/node_modules/adapterjs
  > npm --prefix third_party/adapter install third_party/adapter

  npm ERR! Linux 4.4.14-24.50.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.6-linux-x64/bin/npm" "--prefix" "third_party/adapter" "i
nstall" "third_party/adapter"
  npm ERR! node v4.4.6
  npm ERR! npm  v2.15.5
  npm ERR! path /tmp/.npm/sdp
  npm ERR! code EACCES
  npm ERR! errno -13
  npm ERR! syscall mkdir

  npm ERR! Error: EACCES: permission denied, mkdir '/tmp/.npm/sdp'
  npm ERR!     at Error (native)
  npm ERR!  { [Error: EACCES: permission denied, mkdir '/tmp/.npm/sdp']
  npm ERR!   errno: -13,
  npm ERR!   code: 'EACCES',
  npm ERR!   syscall: 'mkdir',
  npm ERR!   path: '/tmp/.npm/sdp',
  npm ERR!   parent: 'webrtc-adapter' }
  npm ERR! 
  npm ERR! Please try running this command again as root/Administrator.

  npm ERR! Please include the following file with any support request:
  npm ERR!     /tmp/deployment/application/node_modules/adapterjs/npm-debug.log
  npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead!

Problem has been probably caused by https://github.com/Temasys/AdapterJS/commit/caf91bdbf4129e268904149e72c4c18e1b1f422a.

Workaround is to execute following commands on the AWS EB server before deploying:

chmod a+rwx /tmp/.npm
chmod a+rwx /tmp/.npm/_locks

Is it a bug in AWS or could it be fixed in AdapterJS?

zdila avatar Oct 17 '16 10:10 zdila

Hi,

Someone else came up with this issue not too long ago, however, I tested again, and this time on an ec2 instance, and it worked fine for me.

It looks to me like someone ran an npm command as root and left some bad tmp files on your instance... If that's the case, there is not much that we can do about it.

johache avatar Oct 18 '16 01:10 johache

That someone is AWS EB deploy script. We've never deployed our app on the server in other way than eb deploy from remote machine.

I've tried to rm -rf /tmp/.npm and do the eb deploy but the result was the same. After doing chmod a+rwx /tmp/.npm; chmod a+rwx /tmp/.npm/_locks and running eb deploy again it worked. Afterwards I checked ownership of files in /tmp/.npm/. All directories were root:root just sdp was ec2-user:root. It looks like postinstall phase is run with the different user (ec2-user - the default user).

I am admitting that the bug can be in AWS deployment script, but I am wondering that among all other direct dependencies (60) the only problematic seems to be adapterjs.

zdila avatar Oct 18 '16 09:10 zdila

Here they have the same problems: https://github.com/mapnik/node-mapnik/issues/659.

zdila avatar Oct 18 '16 09:10 zdila