Fsevents: Does not work with Node v4.2.3

Created on 7 Jan 2016  路  9Comments  路  Source: fsevents/fsevents

gyp ERR! cwd /tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/50npm.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":1,"events":[{"msg":"Failed to run npm install. Snapshot logs for more details.","severity":"ERROR","timestamp":1452147841151}]}],"truncated":"true"}
[2016-01-07T06:24:01.184Z] Command return code 1.
[2016-01-07T06:24:01.188Z] Tailing /var/log/eb-commandprocessor.log

******************* eb-commandprocessor taillog *******************
  npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
  npm ERR! This is most likely a problem with the fsevents package,
  npm ERR! not with npm itself.
  npm ERR! Tell the author that this fails on your system:
  npm ERR!     node-pre-gyp install --fallback-to-build
  npm ERR! You can get their info via:
  npm ERR!     npm owner ls fsevents
  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.2.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.2.3-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1
  gyp ERR! configure error 
  gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents/build'
  gyp ERR! stack     at Error (native)
  gyp ERR! System Linux 4.1.13-18.26.amzn1.x86_64
  gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v4.2.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v4.2.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-linux-x64/fse.node" "--module_name=fse" "--module_path=/tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v46-linux-x64"
  gyp ERR! cwd /tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents
  gyp ERR! node -v v4.2.3
  gyp ERR! node-gyp -v v3.0.3
Jan  7 06:24:01 ip-172-31-47-105 [eb-cfn-init]:   gyp ERR! not ok  (Executor::NonZeroExitStatus)

Most helpful comment

npm config set unsafe-perm true

All 9 comments

That looks like an issue with elastic beanstalk, not node or fsevents. You need to fix the EACCES error somehow.

Hi, that was also my thought but here is the response I got from AWS tech support:

The package is trying to create a folder under tmp which anyone can write to but if you are creating sub directories you need the -P switch.
Here are the perms to the tmp folder drwxrwxrwt 6 root root 4096 ('t' is the sticky bit https://en.wikipedia.org/wiki/Sticky_bit)

Your Reported error:
stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents/build'

I was able to run the same command on the instance as mkdir -P /tmp/deployment/application/node_modules/forever-monitor/node_modules/chokidar/node_modules/fsevents/build and this worked fine.

So to get around EACCES: permission denied the lines in the package needs to be modified with -P switch.

I kind of doubt that's it (and I assume you mean -p, I don't think mkdir has a -P flag.) node-gyp creates directories recursively using the mkdirp package.

I'm facing the same issues with AWS-- seems like a temporary solution can be found here.

I had the same issue with the dependency coming from the nodemon module. After uninstalling nodemon it worked fine. See issue. Maybe you have the same issue with the forever-monitor.

npm config set unsafe-perm true

Posting in hopes to spare someone else the grief of debugging this error. The issue was fixed for me by adding a trailing slash to the node_modules folder in .ebignore

.ebignore

node_modules/

Without the trailing slash, eb will upload your local node_modules folder - dev dependencies and all.

Thanks a lot, @unreal0 ! Your solution helped me (contrary to others). I have made it easier to find via SO: https://stackoverflow.com/questions/46001516/beanstalk-node-js-deployment-node-gyp-fails-due-to-permission-denied/46001517#46001517

Add a file named .npmrc to the application with the content:

unsafe-perm=true
Now use the following command before pushing it to ElasticBeanStalk:

    git add .npmrc
    git commit -m"EB issue fix"

Now deploy your code. It should work.

Was this page helpful?
0 / 5 - 0 ratings