Cli: Error installing heroku-cli-deploy

Created on 1 Sep 2017  路  14Comments  路  Source: heroku/cli

I build an application with Shippable (so, with an empty docker image) and while building my application today, it gave me this error message while installing heroku-cli-deploy:

 heroku plugins:install heroku-cli-deploy
WARNING
WARNING Node version must be >=8.3.0 to use the Heroku CLI
WARNING
/usr/local/lib/node_modules/heroku-cli/node_modules/cli-engine-config/lib/config.js:150
        ...defaultConfig.pjson,
        ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/heroku-cli/node_modules/cli-engine-command/lib/output/index.js:32:24)

It was a re-build of an already successfull build done last tuesday at 7:00 PM. Is there any problem with heroku-cli-deploy version? I haven't found anything on the internet!

Thanks,

Update 1: I noticed that there was an update on the heroku-cli, so I tried to install the version that was successful (6.13.19), but it gave me the same error.

Most helpful comment

To those who have found this error when installing heroku into the AWS cloud9 environment while following the Michael Hartl rails tutorial, here's what I did to solve this issue:

1. Install and use Node 8.3

To install:
$ nvm install 8.3

Or if you already have it installed and need to switch to it:
$ nvm use 8.3

2. Reinstall the Heroku CLI

$ npm install -g heroku-cli

After installing you might get this warning:
npm WARN [email protected] requires a peer of cli-engine-command@^8.0.0 but none was installed.

In this case, do as @fabianjs suggested:
$ npm i -g cli-engine-config
$ npm i -g cli-engine-command

3. Check proper installation

Run
$ heroku -v

You should get something like
heroku-cli/6.16.13 (linux-x64) node-v8.3.0

Later, if your environment gets restarted, the Node version might get set back on whatever it was before (v6.13.1 in my case), so heroku will give you the same error as before, so make sure to switch to the right version of node
$ nvm use 8.3

Hope this helps someone out, I spent way too long getting around this issue!

All 14 comments

I'm not familiar with shippable but you should use one of the install methods that isn't npm if you don't want to have to stay on the latest node version. This is failing due to syntax that requires node 8.3 or above.

Not pretty sure that this is the problem. Here follows the same message on a successful install:

heroku plugins:install heroku-cli-deploy 4s  
WARNING
WARNING Node version must be >=8.0.0 to use the Heroku CLI
WARNING
Installing plugin heroku-cli-deploy... done

The version has changed because I'm using an older version of the cli.

Yes.

So the problem doesn't appears to be node's version. I was able to do the install with node 7.10.0 and now it is breaking:

npm install -g [email protected] 
  heroku plugins:install heroku-cli-deploy   
WARNING
WARNING Node version must be >=8.0.0 to use the Heroku CLI
WARNING
/usr/local/lib/node_modules/heroku-cli/node_modules/cli-engine-config/lib/config.js:150
        ...defaultConfig.pjson,
        ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/heroku-cli/node_modules/cli-engine-command/lib/output/index.js:32:24)

node version was always fixes at 7.10.0

Yes, this is a node problem. The CLI definitely does not work on 7 and will cause that error. If it was working before you were on an older version

You can use the standalone installer which comes with its own version of node built in

The solution I've found for my environment was to update node version when needed to use heroku-cli, and than came back to the version needed to build my environment. But it was previously working, with node 7.10.0.

Thanks!

receiving the same error message on my end. Updating node version does not solve the issue for me unfortunately.

Managed to fix by updating heroku-cli with:
npm install -g [email protected]

To those who have found this error when installing heroku into the AWS cloud9 environment while following the Michael Hartl rails tutorial, here's what I did to solve this issue:

1. Install and use Node 8.3

To install:
$ nvm install 8.3

Or if you already have it installed and need to switch to it:
$ nvm use 8.3

2. Reinstall the Heroku CLI

$ npm install -g heroku-cli

After installing you might get this warning:
npm WARN [email protected] requires a peer of cli-engine-command@^8.0.0 but none was installed.

In this case, do as @fabianjs suggested:
$ npm i -g cli-engine-config
$ npm i -g cli-engine-command

3. Check proper installation

Run
$ heroku -v

You should get something like
heroku-cli/6.16.13 (linux-x64) node-v8.3.0

Later, if your environment gets restarted, the Node version might get set back on whatever it was before (v6.13.1 in my case), so heroku will give you the same error as before, so make sure to switch to the right version of node
$ nvm use 8.3

Hope this helps someone out, I spent way too long getting around this issue!

@etowahs you're a Saint. Thank you!

thank you! @etowahs
worked.

I tried using these commands to update the Node to version - 10 and it worked fine with Heroku:

sudo npm install n -g
sudo n 0.12.2
sudo n stable

Reference: StackOverflow

Just to update @etowahs post, this is how I got around the issue in AWS Cloud9:

  1. Installing Node
    nvm install 8.x
    But if you don't know what x is then use this general approach:
    nvm install v8
    This will install the latest release under version 8
    Or you could just find out what x is by running:
    nvm ls
    This should list all the different Node versions you have installed. Different client projects may require specific versions.
    If you already have Node installed and need to switch versions just run:
    nvm use v8

  2. Install Heroku
    npm install -g heroku

  3. Check if Heroku was installed properly
    Run
    heroku -v

  4. When you restart your environment it will use an older version of Node (the one which was causing problems). Simply run:
    nvm use v8
    But you'll have to do this all the time. What if there was a way to set v8 as the default version? There is!!! Run this again:
    nvm ls
    Your problematic version of Node should be the default at the moment. Run this command:
    nvm alias default v8
    nvm ls
    v8 should be the default at this point, the effects will kick in once you restart your environment. Happy coding!!!

Was this page helpful?
0 / 5 - 0 ratings