Node-gyp: Unable to install node-gyp under node 0.10.x SyntaxError: Use of const in strict mode

Created on 26 Sep 2017  ·  4Comments  ·  Source: nodejs/node-gyp

  • Node Version: node 0.10.36 and npm 1.4.28
  • Platform: Linux (CentOS 7)
  • Compiler: gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
  • Module: [email protected]

Verbose output (from npm or node-gyp):

gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64

/usr/local/lib/node_modules/node-gyp/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack SyntaxError: Use of const in strict mode.
gyp ERR! stack     at Module._compile (module.js:439:25)
gyp ERR! stack     at Object.Module._extensions..js (module.js:474:10)
gyp ERR! stack     at Module.load (module.js:356:32)
gyp ERR! stack     at Function.Module._load (module.js:312:12)
gyp ERR! stack     at Module.require (module.js:364:17)
gyp ERR! stack     at require (module.js:380:17)
gyp ERR! stack     at Object.<anonymous> (/usr/local/lib/node_modules/node-gyp/node_modules/request/node_modules/hawk/lib/index.js:5:33)
gyp ERR! stack     at Module._compile (module.js:456:26)
gyp ERR! stack     at Object.Module._extensions..js (module.js:474:10)
gyp ERR! stack     at Module.load (module.js:356:32)
gyp ERR! System Linux 3.10.0-514.26.2.el7.x86_64
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /usr/local/licode/erizoAPI
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>

This used to work, but is now failing for us. Any advice on how to proceed would be appreciated. We are trying to run a legacy system, which uses node 0.10.x

If I try to install the latest node-gyp, it displays some warnings:

sudo npm install -g node-gyp
npm WARN engine [email protected]: wanted: {"node":">= 4"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">= 0.12"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.5.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":">=4.0.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"iojs":">= 1.0.0","node":">= 0.12.0"} (current: {"node":"0.10.36","npm":"1.4.28"})
/usr/local/bin/node-gyp -> /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js
[email protected] /usr/local/lib/node_modules/node-gyp
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Most helpful comment

That is a good workaround. thank you. Here is what I'm using now in case it helps someone else.

sudo npm install -g [email protected] [email protected]

All 4 comments

See request/request#2772. I'm afraid there isn't much you can do except install an older version of request manually.

I don't really want to pin the version of request to 2.81.x because that would prevent it from being shared with npm's copy (when node-gyp is bundled with npm - the common case) but maybe we should for now.

@nodejs/node-gyp Thoughts?

That is a good workaround. thank you. Here is what I'm using now in case it helps someone else.

sudo npm install -g [email protected] [email protected]

I don't really want to pin the version of request to 2.81.x because that would prevent it from being shared with npm's copy (when node-gyp is bundled with npm - the common case) but maybe we should for now.

npm has pinned request to ~2.81.0 so no problem:
https://github.com/npm/npm/blob/v5.4.0/package.json#L100

Closing, #1300 was merged.

Was this page helpful?
0 / 5 - 0 ratings