GlobalNOC / globalnoc-networkmap-panel

A network map panel for Grafana
Other
196 stars 29 forks source link

Can't install #109

Open otatar opened 4 years ago

otatar commented 4 years ago

Cant't build:

ReferenceError: primordials is not defined at fs.js:35:5

Node version: v12.16.1 Gulp: CLI version: 2.3.0 Local version: 3.9.1

amotl commented 4 years ago

Hi there,

@Chrisputer probably mentioned the same issue at https://github.com/panodata/grafana-map-panel/issues/82:

I cannot get this to build at all.

https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node tells us everything about the background why this is happening with newer releases of Node.js like

$ node --version
v14.15.0

Origin of the problem

This issue stems from the fact that gulp@3.9.1 depends on graceful-fs@^3.0.0 which monkeypatches Node.js fs module.

This used to work with Node.js until version 11.15 (which is a version from a development branch and shouldn't be used in production).

graceful-fs@^4.0.0 does not monkeypatch Node.js fs module anymore, which makes it compatible with Node.js > 11.15 (tested and working with versions 12 and 14).

Note that this is not a perennial solution but it helps when you don't have the time to update to gulp@^4.0.0.

So, just add this to the package.json file

  "resolutions": {
    "graceful-fs": "^4.2.4"
  }

and invoke

npx yarn install
npx yarn build

Voila:

yarn run v1.22.10
$ gulp
[23:20:30] Using gulpfile ~/dev/foss/globalnoc-networkmap-panel/gulpfile.js
[23:20:30] Starting 'default'...
[23:20:30] Finished 'default' after 34 ms
[23:20:30] gulp-debug: src/CustomHover.js
[23:20:30] gulp-debug: src/atlas3.js
[23:20:30] gulp-debug: src/module.js
[dialog.css]..................built in 667ms
[23:20:30] gulp-debug: src/scale.js
[23:20:30] gulp-debug: 4 items
[leafletmap.css]..............built in 786ms
[datasource.js]...............built in 2119ms
[legend.js]...................built in 2276ms
[leafletmap.js]...............built in 2682ms
✨  Done in 4.48s.

With kind regards, Andreas.

amotl commented 4 years ago

117 is a pull request which includes this small update outlined above.