entur / vehicle-map-demo

European Union Public License 1.2
1 stars 1 forks source link

How to Run, Test or Deploy #45

Closed dancesWithCycles closed 2 years ago

dancesWithCycles commented 2 years ago

Hi folks, Thank you so much for providing this repository. It looks promising. Do you mind providing me with an idea on how to run, test or deploy this repository?

Calling npm install in the root directory with Node.js version v17.7.1 failed. Is there a recommended Node.js version?

Cheers!

testower commented 2 years ago

This project is a plain CRA-based React app. Can you provide some more details on the failure please.

dancesWithCycles commented 2 years ago

Hi @testower , Thank you very much for reaching out to me. I am checking out this repository and calling npm i. I get the following error in response.

npm i
npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
(##################) ⠦ idealTree:inflate:node_modules/once: sill inflate node_monpm WARN deprecated @types/reach__dialog@0.4.0: This is a stub types definition. @reach/dialog provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/classnames@2.3.1: This is a stub types definition. classnames provides its own type definitions, so you do not need this installed.
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated subscriptions-transport-ws@0.11.0: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws    For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm ERR! code 1
npm ERR! path /home/begerad/git/github/vehicle-map-demo/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@17.7.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! (node:3294) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/.cache/node-gyp/17.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/begerad/.cache/node-gyp/17.7.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/begerad/.cache/node-gyp/17.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/begerad/git/github/vehicle-map-demo/node_modules/gl',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: 1: python: not found
npm ERR! gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.10.0-12-amd64
npm ERR! gyp ERR! command "/home/begerad/.nvm/versions/node/v17.7.1/bin/node" "/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/begerad/git/github/vehicle-map-demo/node_modules/gl
npm ERR! gyp ERR! node -v v17.7.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/begerad/.npm/_logs/2022-05-23T03_55_16_793Z-debug-0.log

It looks like this repository is relying on Python, which is missing on my development host. Do you know what Python is used for in the repository?

Cheers!

testower commented 2 years ago

Python is used by node-gyp, a tool for building native extensions to npm dependencies. https://www.npmjs.com/package/node-gyp

dancesWithCycles commented 2 years ago

Python is used by node-gyp, a tool for building native extensions to npm dependencies. https://www.npmjs.com/package/node-gyp

Hey @testower , Cheers mate, for the insights. Do you also know why node-gyp is used for this repository instead of a pure node.js/react.js JavaScript implementation?

Cheers!

dancesWithCycles commented 2 years ago

BTW, Python is available on my developing host.

python3 -V
Python 3.9.2

I conclude, a missing Python dependency is not the cause of the error replied by `npm i.

testower commented 2 years ago

It's not uncommon for some dependencies that require access to native / OS level APIs. In this particular case, the dependency node-sass uses node-gyp to build libsass (https://sass-lang.com/libsass), which is a C/C++ library for css processing.

testower commented 2 years ago

BTW, Python is available on my developing host.

python3 -V
Python 3.9.2

I conclude, a missing Python dependency is not the cause of the error replied by `npm i.

What is the output of the following command?

python -V
dancesWithCycles commented 2 years ago
python -V
bash: python: command not found

Does node-gyp require a different Python version?

testower commented 2 years ago
npm ERR! /bin/sh: 1: python: not found

You're probably having a problem similar to this: https://github.com/nodejs/node-gyp/issues/2654#issuecomment-1122274050

In short, there is no executable called "python" in your path, which node-gyp expects.

dancesWithCycles commented 2 years ago

Hi @testower , On Debian 11 you can make both Python versions available installing the following package.

sudo apt install python-is-python3 --no-install-recommends

Afterwards, both Python tools point/link to the same version.

python -V
Python 3.9.2
python3 -V
Python 3.9.2

Anyhow, this does not solve this issue. This issue is rather Python details related than the overall Python version.

npm ERR! code 1
npm ERR! path /home/begerad/git/github/vehicle-map-demo/node_modules/gl
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@17.7.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! (node:27331) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/begerad/.cache/node-gyp/17.7.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/begerad/.cache/node-gyp/17.7.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/begerad/.cache/node-gyp/17.7.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/begerad/git/github/vehicle-map-demo/node_modules/gl',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package x11 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `x11.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'x11' found
npm ERR! Package xi was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `xi.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'xi' found
npm ERR! Package xext was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `xext.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'xext' found
npm ERR! gyp: Call to 'pkg-config --libs-only-L --libs-only-other x11 xi xext' returned exit status 1 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 5.10.0-12-amd64
npm ERR! gyp ERR! command "/home/begerad/.nvm/versions/node/v17.7.1/bin/node" "/home/begerad/git/github/vehicle-map-demo/node_modules/gl/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/begerad/git/github/vehicle-map-demo/node_modules/gl
npm ERR! gyp ERR! node -v v17.7.1
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/begerad/.npm/_logs/2022-05-24T12_16_09_981Z-debug-0.log

I appreciate any hints for another workaround that enables me to execute this repository on a Debian 11 host.

Cheers!

testower commented 2 years ago

Clearly, this is not an issue with this repo. You should look at node-gyp or node-sass repos to see if you find similar issues or open an issue there. Some hints though still in the logs:

npm ERR! Package x11 was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `x11.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'x11' found
npm ERR! Package xi was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `xi.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'xi' found
npm ERR! Package xext was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `xext.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'xext' found

Looks like some missing packages. I'm not deeply familiar with the innards of node-gyp or node-sass, so can't really help you there.

dancesWithCycles commented 2 years ago

@testower : BTW, what is the difference between this and mobility-map-demo repository?

testower commented 2 years ago

@testower : BTW, what is the difference between this and mobility-map-demo repository?

dancesWithCycles commented 2 years ago

@testower Cheers!

dancesWithCycles commented 2 years ago

@testower I hope I am getting closer to successfully run npm i.

The gl npm package has the following system dependencies.

That is why I installed the following packages on a rather bare Debian 11 host.

sudo apt install python-is-python3 --no-install-recommends
sudo apt-get install libx11-dev --no-install-recommends
sudo apt-get install -y build-essential libxi-dev libglu1-mesa-dev libglew-dev pkg-config --no-install-recommends

Now I am stuck at this point now.

npm ERR! code 126
npm ERR! path /home/begerad/git/github/vehicle-map-demo/node_modules/@danmarshall/deckgl-typings
npm ERR! command failed
npm ERR! command sh -c indefinitely-typed --folder deck.gl --folder deck.gl__aggregation-layers --folder deck.gl__arcgis --folder deck.gl__carto --folder deck.gl__core --folder deck.gl__extensions --folder deck.gl__geo-layers --folder deck.gl__google-maps --folder deck.gl__json --folder deck.gl__layers --folder deck.gl__mapbox --folder deck.gl__mesh-layers --folder deck.gl__react --folder luma.gl__constants --folder luma.gl__core --folder luma.gl__gltools --folder luma.gl__webgl --folder luma.gl__webgl-state-tracker --folder math.gl --folder math.gl__core
npm ERR! sh: 1: indefinitely-typed: Permission denied

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/begerad/.npm/_logs/2022-05-24T12_58_45_780Z-debug-0.log
$ tail -n30 /home/begerad/.npm/_logs/2022-05-24T12_58_45_780Z-debug-0.log
6677 verbose stack Error: command failed
6677 verbose stack     at ChildProcess.<anonymous> (/home/begerad/.nvm/versions/node/v17.7.1/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
6677 verbose stack     at ChildProcess.emit (node:events:527:28)
6677 verbose stack     at maybeClose (node:internal/child_process:1090:16)
6677 verbose stack     at Socket.<anonymous> (node:internal/child_process:449:11)
6677 verbose stack     at Socket.emit (node:events:527:28)
6677 verbose stack     at Pipe.<anonymous> (node:net:709:12)
6678 verbose pkgid @danmarshall/deckgl-typings@4.9.15
6679 verbose cwd /home/begerad/git/github/vehicle-map-demo
6680 verbose Linux 5.10.0-12-amd64
6681 verbose argv "/home/begerad/.nvm/versions/node/v17.7.1/bin/node" "/home/begerad/.nvm/versions/node/v17.7.1/bin/npm" "i"
6682 verbose node v17.7.1
6683 verbose npm  v8.5.2
6684 error code 126
6685 error path /home/begerad/git/github/vehicle-map-demo/node_modules/@danmarshall/deckgl-typings
6686 error command failed
6687 error command sh -c indefinitely-typed --folder deck.gl --folder deck.gl__aggregation-layers --folder deck.gl__arcgis --folder deck.gl__carto --folder deck.gl__core --folder deck.gl__extensions --folder deck.gl__geo-layers --folder deck.gl__google-maps --folder deck.gl__json --folder deck.gl__layers --folder deck.gl__mapbox --folder deck.gl__mesh-layers --folder deck.gl__react --folder luma.gl__constants --folder luma.gl__core --folder luma.gl__gltools --folder luma.gl__webgl --folder luma.gl__webgl-state-tracker --folder math.gl --folder math.gl__core
6688 error sh: 1: indefinitely-typed: Permission denied
6689 verbose exit 126
6690 timing npm Completed in 491407ms
6691 verbose unfinished npm timer reify 1653397126211
6692 verbose unfinished npm timer reify:build 1653397183302
6693 verbose unfinished npm timer build 1653397183308
6694 verbose unfinished npm timer build:deps 1653397183309
6695 verbose unfinished npm timer build:run:postinstall 1653397610221
6696 verbose unfinished npm timer build:run:postinstall:node_modules/@danmarshall/deckgl-typings 1653397610221
6697 verbose unfinished npm timer build:run:postinstall:node_modules/node-sass 1653397610321
6698 verbose code 126
6699 error A complete log of this run can be found in:
6699 error     /home/begerad/.npm/_logs/2022-05-24T12_58_45_780Z-debug-0.log

Anyone an idea what is the issue now?

testower commented 2 years ago

I'm afraid I don't know.

dancesWithCycles commented 2 years ago

@testower No worries! However, I wonder what is the typical environment Entur is using to develop and operate this repository? If I am just asked to call npm install and npm run start to run this repository, there must be an environment difference. What is your OS, node and Python version?

dancesWithCycles commented 2 years ago

The last error was due to a broken installation. After calling rm -r node_modules/ package-lock.json to clean the repository and again npm i I am back on track with my Python issue that is replying like this now. I hope this is a journey that leads me somewhere. ;-)

npm ERR! code 1
npm ERR! path /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /home/begerad/.nvm/versions/node/v17.7.1/bin/node /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   '/home/begerad/.nvm/versions/node/v17.7.1/bin/node',
npm ERR! gyp verb cli   '/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@17.7.1 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:13:12)
npm ERR! gyp verb `which` failed     at F (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:68:19)
npm ERR! gyp verb `which` failed     at E (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:80:29)
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/which/which.js:89:16
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/isexe/index.js:42:5
npm ERR! gyp verb `which` failed     at /home/begerad/git/github/vehicle-map-demo/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python /usr/bin/python
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack 
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:398:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1090:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:449:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:709:12)
npm ERR! gyp ERR! System Linux 5.10.0-12-amd64
npm ERR! gyp ERR! command "/home/begerad/.nvm/versions/node/v17.7.1/bin/node" "/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass
npm ERR! gyp ERR! node -v v17.7.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/begerad/.npm/_logs/2022-05-24T19_51_27_539Z-debug-0.log
testower commented 2 years ago

I have never seen this problem before, and I’ve seen a lot of projects using node-gyp. macOS, Linux and windows. I have no idea what the problem is. The whole point of node-gyp is to be cross platform.

But it seems you are likely to run into this problem on any project that has a dependency that requires node-gyp at least, which would be a fair amount given that it has 45 million downloads per month on npmjs.com.

dancesWithCycles commented 2 years ago

I am finally stuck and ran out of ideas at the moment.

I installed Python2 including the dev package.

sudo apt install python2-minimal --no-install-recommends
sudo apt install python3-dev --no-install-recommends
sudo apt install python-dev --no-install-recommends

I made sure build essentials are installed.

sudo apt install build-essential --no-install-recommends
sudo apt install gcc --no-install-recommends

From my perspective, the development host fulfills the system requirements of node-gyp.

make -v
GNU Make 4.3
gcc -v
gcc version 10.2.1 20210110 (Debian 10.2.1-6)
node -v
v17.7.1
python -V
Python 2.7.18
python2 -V
Python 2.7.18
python3 -V
Python 3.9.2

Still I am not there yet.

tail -n100 /home/begerad/.npm/_logs/2022-05-25T04_57_06_955Z-debug-0.log
13352 error gyp verb node dev dir /home/begerad/.node-gyp/17.7.1
13352 error gyp verb `which` succeeded for `make` /usr/bin/make
13352 error gyp info spawn make
13352 error gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
13352 error ../src/libsass/src/cencode.c: In function ‘base64_encode_block’:
13352 error ../src/libsass/src/cencode.c:48:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
13352 error    48 |    result = (fragment & 0x003) << 4;
13352 error       |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
13352 error ../src/libsass/src/cencode.c:52:2: note: here
13352 error    52 |  case step_B:
13352 error       |  ^~~~
13352 error ../src/libsass/src/cencode.c:62:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
13352 error    62 |    result = (fragment & 0x00f) << 2;
13352 error       |    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
13352 error ../src/libsass/src/cencode.c:66:2: note: here
13352 error    66 |  case step_C:
13352 error       |  ^~~~
13352 error ../src/libsass/src/functions.cpp: In function ‘void Sass::Functions::handle_utf8_error(const Sass::ParserState&, Sass::Backtraces)’:
13352 error ../src/libsass/src/functions.cpp:110:20: warning: catching polymorphic type ‘class utf8::invalid_code_point’ by value [-Wcatch-value=]
13352 error   110 |       catch (utf8::invalid_code_point) {
13352 error       |                    ^~~~~~~~~~~~~~~~~~
13352 error ../src/libsass/src/functions.cpp:114:20: warning: catching polymorphic type ‘class utf8::not_enough_room’ by value [-Wcatch-value=]
13352 error   114 |       catch (utf8::not_enough_room) {
13352 error       |                    ^~~~~~~~~~~~~~~
13352 error ../src/libsass/src/functions.cpp:118:20: warning: catching polymorphic type ‘class utf8::invalid_utf8’ by value [-Wcatch-value=]
13352 error   118 |       catch (utf8::invalid_utf8) {
13352 error       |                    ^~~~~~~~~~~~
13352 error ../src/libsass/src/json.cpp: In function ‘char* json_encode_string(const char*)’:
13352 error ../src/libsass/src/json.cpp:405:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
13352 error   405 |   catch (std::exception) {
13352 error       |               ^~~~~~~~~
13352 error ../src/libsass/src/json.cpp: In function ‘char* json_stringify(const JsonNode*, const char*)’:
13352 error ../src/libsass/src/json.cpp:424:15: warning: catching polymorphic type ‘class std::exception’ by value [-Wcatch-value=]
13352 error   424 |   catch (std::exception) {
13352 error       |               ^~~~~~~~~
13352 error In file included from /home/begerad/.node-gyp/17.7.1/include/node/v8-local-handle.h:12,
13352 error                  from /home/begerad/.node-gyp/17.7.1/include/node/v8-array-buffer.h:12,
13352 error                  from /home/begerad/.node-gyp/17.7.1/include/node/v8.h:25,
13352 error                  from /home/begerad/.node-gyp/17.7.1/include/node/node.h:63,
13352 error                  from ../../nan/nan.h:58,
13352 error                  from ../src/binding.cpp:1:
13352 error /home/begerad/.node-gyp/17.7.1/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
13352 error /home/begerad/.node-gyp/17.7.1/include/node/v8-internal.h:563:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
13352 error   563 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
13352 error       |                                      ^~~~~~~~~~~
13352 error       |                                      remove_cv
13352 error /home/begerad/.node-gyp/17.7.1/include/node/v8-internal.h:563:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
13352 error   563 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
13352 error       |                                      ^~~~~~~~~~~
13352 error       |                                      remove_cv
13352 error /home/begerad/.node-gyp/17.7.1/include/node/v8-internal.h:563:50: error: template argument 2 is invalid
13352 error   563 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
13352 error       |                                                  ^
13352 error /home/begerad/.node-gyp/17.7.1/include/node/v8-internal.h:563:63: error: ‘::Perform’ has not been declared
13352 error   563 |             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
13352 error       |                                                               ^~~~~~~
13352 error ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
13352 error ../src/binding.cpp:284:80: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
13352 error   284 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
13352 error       |                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13352 error ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
13352 error ../src/binding.cpp:320:80: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
13352 error   320 |     int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
13352 error       |                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13352 error In file included from ../../nan/nan.h:58,
13352 error                  from ../src/binding.cpp:1:
13352 error ../src/binding.cpp: At global scope:
13352 error /home/begerad/.node-gyp/17.7.1/include/node/node.h:848:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
13352 error   848 |       (node::addon_register_func) (regfunc),                          \
13352 error       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13352 error /home/begerad/.node-gyp/17.7.1/include/node/node.h:882:3: note: in expansion of macro ‘NODE_MODULE_X’
13352 error   882 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
13352 error       |   ^~~~~~~~~~~~~
13352 error ../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
13352 error   358 | NODE_MODULE(binding, RegisterModule);
13352 error       | ^~~~~~~~~~~
13352 error make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
13352 error gyp ERR! build error 
13352 error gyp ERR! stack Error: `make` failed with exit code: 2
13352 error gyp ERR! stack     at ChildProcess.onExit (/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/node-gyp/lib/build.js:262:23)
13352 error gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
13352 error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
13352 error gyp ERR! System Linux 5.10.0-12-amd64
13352 error gyp ERR! command "/home/begerad/.nvm/versions/node/v17.7.1/bin/node" "/home/begerad/git/github/vehicle-map-demo/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
13352 error gyp ERR! cwd /home/begerad/git/github/vehicle-map-demo/node_modules/node-sass
13352 error gyp ERR! node -v v17.7.1
13352 error gyp ERR! node-gyp -v v3.8.0
13352 error gyp ERR! not ok 
13352 error Build failed with error code: 1
13353 verbose exit 1
13354 timing npm Completed in 722422ms
13355 verbose unfinished npm timer reify 1653454627328
13356 verbose unfinished npm timer reify:build 1653454778289
13357 verbose unfinished npm timer build 1653454778297
13358 verbose unfinished npm timer build:deps 1653454778299
13359 verbose unfinished npm timer build:run:postinstall 1653455135237
13360 verbose unfinished npm timer build:run:postinstall:node_modules/node-sass 1653455135526
13361 verbose code 1
13362 error A complete log of this run can be found in:
13362 error     /home/begerad/.npm/_logs/2022-05-25T04_57_06_955Z-debug-0.log

Maybe, I have to sleep another night to come up with a solution.

@testower What system environment are you using to run this repository?

Cheers!

testower commented 2 years ago

It's building fine on my macOS laptop, as well as in our CI environment using docker. Slightly outdated, but you can inspect a working build environment with this docker:

FROM circleci/node:10.13

WORKDIR /app

COPY * /app

RUN npm install
dancesWithCycles commented 2 years ago

FROM circleci/node:10.13

@testower That was the missing piece of information. As a conclusion, this repository is (at the time of writing) compatible with

v10.24.1

but not with

nvm run default --version
Running node v17.7.1 (npm v8.5.2)
v17.7.1

. I am wondering what is the latest node version not breaking the dependencies of this repository.

Anyhow, I am happy to announce that npm i finally came back with a successful reply.

Thank you so much for supporting me on the way getting here.

Cheers!