Netflix / vector

Vector is an on-host performance monitoring framework which exposes hand picked high resolution metrics to every engineer’s browser.
http://getvector.io/
Apache License 2.0
3.58k stars 252 forks source link

constrain node version #170

Closed tom-- closed 6 years ago

tom-- commented 6 years ago

package.json has

  "engines": {
    "node": ">=0.10.0"
  }

This should perhaps have an upper limit since with node 8.6.0

$ gulp build
/Volumes/Sites/vector/node_modules/require-dir/index.js:93
            if (!require.extensions.hasOwnProperty(ext)) {
                                    ^

TypeError: require.extensions.hasOwnProperty is not a function
    at requireDir (/Volumes/Sites/vector/node_modules/require-dir/index.js:93:37)
    at Object.<anonymous> (/Volumes/Sites/vector/node_modules/gulp-git/index.js:4:18)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Volumes/Sites/vector/gulp/scripts.js:7:11)

and with node 4.4.2 gulp completes without error

tom-- commented 6 years ago

I was following http://vectoross.io/docs/building-vector-source

Another option is to mention the constraint there

sofianinho commented 6 years ago

Hello everyone, This is to confirm that indeed there is a problem depending on your node installed version. I am on Ubuntu 16.04 with node v8.8 and I have the following error when I run gulp build:

 if (!require.extensions.hasOwnProperty(ext)) {
                                    ^

TypeError: require.extensions.hasOwnProperty is not a function
    at requireDir (//vector/node_modules/require-dir/index.js:93:37)
    at Object.<anonymous> (/vector/node_modules/gulp-git/index.js:4:18)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Module.require (module.js:556:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/vector/gulp/scripts.js:7:11)

I tried the installation on dockerized nodes. So I grabbed the node:6.11 docker, and tried the installation inside with node v6.11.4 inside; everything went well as expected. I did the same with node:7.10 docker image with node v7.10.0, it works with a warning when you gulp build

[15:18:08] git describe (log : false) 
(node:373) DeprecationWarning: Calling an asynchronous function without callback is deprecated.

I grabbed the next version node:8 on the docker hub, with node v8.7.0 inside and got the same error as before on my machine.

/vector/node_modules/require-dir/index.js:93
            if (!require.extensions.hasOwnProperty(ext)) {
                                    ^

TypeError: require.extensions.hasOwnProperty is not a function
    at requireDir (/vector/node_modules/require-dir/index.js:93:37)
    at Object.<anonymous> (/vector/node_modules/gulp-git/index.js:4:18)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/vector/gulp/scripts.js:7:11)

The build works again when you comment from 93 to 95 of file node_modules/require-dir/index.js before doing gulp build again. Package require-dir is installed with har-validator when you bower install apparently (I just did a quick grep, not sure which other tool nodejs people use)

I hope this helps.

tom-- commented 6 years ago

@sofianinho workaround is to run gulp with an older version of node. 4.4 worked for me

sofianinho commented 6 years ago

@tom-- thanks for the workaround I also referenced that in the post with other working versions. Basically it works fine with a simple warning up to version 7.10 of node. Version 8 of node ends up with the error. You can avoid it by commenting the lines I showed after you do a "bower install". The module that seems to cause the error is require-dir.

spiermar commented 6 years ago

Issue was solved in master (https://github.com/Netflix/vector/pull/173).