Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"SyntaxError: Use of const in strict mode" while installing on Travis (for node@0.12) #308

Closed
broofa opened this issue Jun 21, 2018 · 3 comments

Comments

@broofa
Copy link

broofa commented Jun 21, 2018

In trying to add support for enforcing Conventional Commits on the uuid module I ran into the issue, below. This is happening on Travis, while running the unit tests for node@0.12. The tests for more recent versions of node work.


$ git clone --depth=50 --branch=conventional_commits https://github.com/kelektiv/node-uuid.git kelektiv/node-uuid
Cloning into 'kelektiv/node-uuid'...
remote: Counting objects: 374, done.
remote: Compressing objects: 100% (186/186), done.
remote: Total 374 (delta 198), reused 340 (delta 177), pack-reused 0
Receiving objects: 100% (374/374), 124.10 KiB | 15.51 MiB/s, done.
Resolving deltas: 100% (198/198), done.
$ cd kelektiv/node-uuid
$ git checkout -qf 4d3ae93ec18647ea88b454c7b8d3db912a25446f
$ export PATH=./node_modules/.bin:$PATH
Updating nvm
nvm.install
2.90s$ nvm install 0.12
Downloading and installing node v0.12.18...
Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-linux-x64.tar.xz...
Computing checksum with sha256sum
Checksums matched!
Now using node v0.12.18 (npm v2.15.11)
$ node --version
v0.12.18
$ npm --version
2.15.11
$ nvm --version
0.33.11
63.76s$ npm install 

[... **snip** ...]

> husky@0.14.3 install /home/travis/build/kelektiv/node-uuid/node_modules/husky
> node ./bin/install.js
/home/travis/build/kelektiv/node-uuid/node_modules/husky/bin/install.js:4
const path = require('path')
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
@typicode
Copy link
Owner

Hi @broofa,

Ahah interesting use case :) thanks for sharing.

Husky v1.0.0-rc.9 supports only Node 6+ and I'm not even sure that the dependencies used would go down to Node 0.12.

As a temporary workaround, I'd suggest changing npm install to npm install --ignore-scripts in your .travis.yml config file.

I'll think about something that would work with Node 0.12 and wouldn't require disabling all scripts

@broofa
Copy link
Author

broofa commented Jun 22, 2018

Since it's Travis doing the install (on their test servers), I'm not sure how much control I have over the flags used.

For the time being I've solved this on our side by dropping 0.12 from our .travis.yml. I'll reopen if we need to add that back in later.

@typicode
Copy link
Owner

typicode commented Jul 5, 2018

@broofa it should be good now with husky v1.0.0-rc12 ;) https://travis-ci.org/typicode/please-upgrade-node/jobs/400214097#L471

And as for setting flags on Travis, it's actually quite easy (was doing this before to avoid running husky's own install script https://github.com/typicode/husky/blob/v1.0.0-rc.6/.travis.yml#L7-L8)

tdascoli added a commit to tdascoli/forms-engine that referenced this issue Jul 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants