ERROR: Failed to download Chromium at AWS deployment.



  • Hello, I am trying to deploy my jsreport app to AWS, I am using elastic beanstalk. The issue is that every time npm install fails with the following error:

    ERROR: Failed to download Chromium r579032! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
    { Error: EACCES: permission denied, open '/tmp/deployment/application/node_modules/jsreport/node_modules/puppeteer/.local-chromium/download-linux-579032.zip'
    errno: -13,
    code: 'EACCES',
    syscall: 'open',
    path: '/tmp/deployment/application/node_modules/jsreport/node_modules/puppeteer/.local-chromium/download-linux-579032.zip' }
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! puppeteer@1.7.0 install: node install.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the puppeteer@1.7.0 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    npm ERR! A complete log of this run can be found in:
    npm ERR! /tmp/.npm/_logs/2018-11-06T13_13_16_079Z-debug.log
    Running npm install: /opt/elasticbeanstalk/node-install/node-v8.12.0-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 695, in <module>
    main()
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 677, in main
    node_version_manager.run_npm_install(options.app_path)
    File "/opt/elasticbeanstalk/containerfiles/ebnode.py", line 136, 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 180, in npm_install
    raise e
    subprocess.CalledProcessError: Command '['/opt/elasticbeanstalk/node-install/node-v8.12.0-linux-x64/bin/npm', '--production', 'rebuild']' returned non-zero exit status 1.
    Incorrect application version "abamatrix-reports" (deployment 4). Expected version "abamatrix-reports" (deployment 1).

    Any help will be much appreciated.



  • We have steps required for running chrome on amazon linux described here
    https://jsreport.net/learn/amazon-linux

    I guess you need to run those in your .ebextensions.

    You can also check these links which pops up on the first google search
    https://github.com/GoogleChrome/puppeteer/issues/765
    https://gist.github.com/chimmelb/6342504893b2b9fce0f4a8efd096ae60

    If you are just trying to set jsreport quickly up.
    I would recommend to use docker in elastic beanstalk, then it should be just about setting the jsreport official image.



  • I am having this same issue as well. I've gone through the amazon-linux steps but they fail with the same error. Trying to work through it now, but not sure how to get around this.

    jsreport installation not found, installing jsreport latest version now, wait a moment...
    Unexpected error happened: Command failed: npm i -S jsreport
    ERROR: Failed to download Chromium r662092! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
    { Error: EACCES: permission denied, mkdir '/opt/mynewapp/node_modules/puppeteer/.local-chromium'
      -- ASYNC --
        at BrowserFetcher.<anonymous> (/opt/mynewapp/node_modules/puppeteer/lib/helper.js:110:27)
        at Object.<anonymous> (/opt/mynewapp/node_modules/puppeteer/install.js:64:16)
        at Module._compile (module.js:653:30)
        at Object.Module._extensions..js (module.js:664:10)
        at Module.load (module.js:566:32)
        at tryModuleLoad (module.js:506:12)
        at Function.Module._load (module.js:498:3)
        at Function.Module.runMain (module.js:694:10)
        at startup (bootstrap_node.js:204:16)
        at bootstrap_node.js:625:3
      errno: -13,
      code: 'EACCES',
      syscall: 'mkdir',
      path: '/opt/mynewapp/node_modules/puppeteer/.local-chromium' }
    npm WARN pdfjs-dist@2.0.489 requires a peer of webpack@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN worker-loader@1.1.1 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
    npm WARN jsreport-server@ No description
    npm WARN jsreport-server@ No repository field.
    npm WARN jsreport-server@ No license field.
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! puppeteer@1.17.0 install: `node install.js`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the puppeteer@1.17.0 install script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2019-07-30T18_08_13_488Z-debug.log
     (1).
    caused by error (1) -> meta = {"killed":false,"code":1,"signal":null,"cmd":"npm i -S jsreport"}, stack = Error:
        at ChildProcess.exithandler (child_process.js:281:12)
        at emitTwo (events.js:126:13)
        at ChildProcess.emit (events.js:214:7)
        at maybeClose (internal/child_process.js:915:16)
        at Socket.stream.socket.on (internal/child_process.js:336:11)
        at emitOne (events.js:116:13)
        at Socket.emit (events.js:211:7)
        at Pipe._handle.close [as _onclose] (net.js:561:12)
    


  • The above error was on the jsreport init call



  • I wasn't able to make progress. The error is the same as above. I CAN get past it if I do
    sudo npm i -S jsreport --unsafe-perm=true
    jsreport init
    But, in the application there is still an error. The error is:

    or: Failed to launch chrome!
    [0730/185614.730358:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
    
    
    TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md
    
        at onClose (/opt/mynewapp/node_modules/puppeteer/lib/Launcher.js:342:14)
        at Interface.helper.addEventListener (/opt/mynewapp/node_modules/puppeteer/lib/Launcher.js:331:50)
        at emitNone (events.js:111:20)
        at Interface.emit (events.js:208:7)
        at Interface.close (readline.js:368:8)
        at Socket.onend (readline.js:147:10)
        at emitNone (events.js:111:20)
        at Socket.emit (events.js:208:7)
        at endReadableNT (_stream_readable.js:1064:12)
        at _combinedTickCallback (internal/process/next_tick.js:139:11)
        at process._tickCallback (internal/process/next_tick.js:181:9)
    


  • A few more notes. I'm on amazon linux 2 and I'm not using elastic beanstalk. I'm not running on docker.



  • Just figured it out. Wow. I thought I was going to have to switch to Ubuntu, but the following fixes it for me.

    sudo npm i -S jsreport --unsafe-perm=true
    jsreport init

    and then change your chrome options like is listed in the CentOS documentation

    https://jsreport.net/learn/centos`

    # change in the jsreport.config.json the following
    # it makes chrome less secure but currently the only way on CentOS
    "chrome": {
      "launchOptions": {
        "args": ["--no-sandbox"]
      }
    }
    



  • administrators

    hmm i don't know.. when you install something with that flag --unsafe-perm=true it just means that npm was installed in bad way that it requires that you have admin privileges to do something, and in that case you need to fix the npm installation by doing something like the steps described here: https://gist.github.com/rafszul/6978ef2106992db0178bc4426b5e6f1c or https://lightrains.com/blogs/fixing-npm-permissions-install-global. but i never tried amazon linux 2 so you may be right that this is needed.



  • You may be right. I did have to play around with node_modules permissions, but don't remember if that made it into the final cut or not. As I terraform this I'll remember and update.



  • I didn't need to change the permissions of node_modules. There may be an alternate way to solve the problem, though.


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.