node-gdal icon indicating copy to clipboard operation
node-gdal copied to clipboard

Failure to install on AWS Linux

Open mramato opened this issue 8 years ago • 3 comments

This may be related to #169, but it's different enough that I figured I'd open a new issue. I have an AWS Elastic Beanstalk app that depends on node-gdal but npm install seems to fail. I've never had a problem with npm packages not installing properly on AWS before; so I don't think it's a configuration option on my end (but I'd love for that to be the case). Any help would be greatly appreciated.

  > [email protected] preinstall /tmp/deployment/application/node_modules/tilertron/node_modules/gdal
  > npm install node-pre-gyp

  npm ERR! Linux 4.4.8-20.46.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/npm" "install" "node-pre-gyp"
  npm ERR! node v4.4.3
  npm ERR! npm  v2.15.1
  npm ERR! path /tmp/.npm/node-pre-gyp
  npm ERR! code EACCES
  npm ERR! errno -13
  npm ERR! syscall mkdir

  npm ERR! Error: EACCES: permission denied, mkdir '/tmp/.npm/node-pre-gyp'
  npm ERR!     at Error (native)
  npm ERR!  { [Error: EACCES: permission denied, mkdir '/tmp/.npm/node-pre-gyp']
  npm ERR!   errno: -13,
  npm ERR!   code: 'EACCES',
  npm ERR!   syscall: 'mkdir',
  npm ERR!   path: '/tmp/.npm/node-pre-gyp',
  npm ERR!   parent: 'gdal' }
  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/tilertron/node_modules/gdal/npm-debug.log
  npm ERR! Linux 4.4.8-20.46.amzn1.x86_64
  npm ERR! argv "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/npm" "--production" "install"
  npm ERR! node v4.4.3
  npm ERR! npm  v2.15.1
  npm ERR! code ELIFECYCLE

  npm ERR! [email protected] preinstall: `npm install node-pre-gyp`
  npm ERR! Exit status 243
  npm ERR! 
  npm ERR! Failed at the [email protected] preinstall script 'npm install node-pre-gyp'.
  npm ERR! This is most likely a problem with the gdal package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     npm install node-pre-gyp
  npm ERR! You can get information on how to open an issue for this project with:
  npm ERR!     npm bugs gdal
  npm ERR! Or if that isn't available, you can get their info via:
  npm ERR! 
  npm ERR!     npm owner ls gdal
  npm ERR! There is likely additional logging output above.

  npm ERR! Please include the following file with any support request:
  npm ERR!     /tmp/deployment/application/npm-debug.log
  Running npm install:  /opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/npm
  Setting npm config jobs to 1
  npm config jobs set to 1
  Running npm with --production flag
  Failed to run npm install. Snapshot logs for more details.
  Traceback (most recent call last):
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 681, in <module>
      main()
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 663, in main
      node_version_manager.run_npm_install(options.app_path)
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 131, in run_npm_install
      self.npm_install(bin_path, self.config_manager.get_container_config('app_staging_dir'))
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 166, in npm_install
      raise e
  subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v4.4.3-linux-x64/bin/npm', '--production', 'install']' returned non-zero exit status 1 (Executor::NonZeroExitStatus)

mramato avatar May 20 '16 13:05 mramato

Have you ever SSH'ed into your instance and run an npm install? Have you installed using a different user or used sudo? I'd first log into your box and run ls -la /tmp/.npm to see who owns /tmp/.npm and what the permissions are. That will be the root of the problem, but if you'd like to get around immediately it wouldn't hurt to add this to your deploy process:

sudo mkdir -p /tmp/.npm
sudo chown -R $(whoami) /tmp/.npm

# (or this)
sudo mkdir -p $(npm config get cache)
sudo chown -R $(whoami) $(npm config get cache)

brianreavis avatar May 20 '16 13:05 brianreavis

I am having this same issue when trying to install mapnik on beanstalk, did you ever find a solution?

BHare1985 avatar Jun 20 '16 04:06 BHare1985

I am now getting this error as I updated some of my dependencies and now I am using the latest gdal.

The issue is related to the permissions that AWS has for preinstall scripts. See the reference issue here: https://github.com/mapnik/node-mapnik/issues/659

My suggestion is to report this issue to npm/AWS or simply deploy with the proposed script mentioned in the reference issue

BHare1985 avatar Sep 21 '16 00:09 BHare1985