kosmas58 / pia-docker

Killian Kemps (https://github.com/KillianKemps) has created an awesome Docker configuration to setup a Docker environment for production purpose. Thanks to Killian it is much easier now to run PIA. A simple docker-compose up does everything and gives a running website : front-end, back-end and database.
GNU General Public License v3.0
37 stars 34 forks source link

Cannot build because of nodejs vs node-sass #18

Open djechelon opened 3 years ago

djechelon commented 3 years ago

Hello,

I tried to build the stack today with docker compose up -d but it failed at the front end


 > [pia-docker_cnil-pia-front  4/13] RUN  /usr/bin/npm install npm@latest -g  && /usr/bin/npm install --unsafe-perm -g node-sass  && /usr/bin/npm install -g @angular/cli:
#22 25.98 /opt/node-v10.16.0-linux-x64/bin/npx -> /opt/node-v10.16.0-linux-x64/lib/node_modules/npm/bin/npx-cli.js
#22 25.98 /opt/node-v10.16.0-linux-x64/bin/npm -> /opt/node-v10.16.0-linux-x64/lib/node_modules/npm/bin/npm-cli.js
#22 26.63 + npm@7.19.1
#22 26.63 added 66 packages from 31 contributors, removed 236 packages and updated 190 packages in 24.939s
#22 27.09 (node:26) ExperimentalWarning: The fs.promises API is experimental
#22 35.61 npm WARN EBADENGINE Unsupported engine { package: 'node-sass@6.0.1',
#22 35.61 npm WARN EBADENGINE   required: { node: '>=12' },
#22 35.61 npm WARN EBADENGINE   current: { node: 'v10.16.0', npm: '7.19.1' } }
#22 48.95 npm WARN deprecated har-validator@5.1.5: this library is no longer supported
#22 50.78 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.
#22 51.21 npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
#22 57.60 npm ERR! code 1
#22 57.61 npm ERR! path /opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass
#22 57.61 npm ERR! command failed
#22 57.61 npm ERR! command sh -c node scripts/build.js
#22 57.61 npm ERR! Building: /opt/node-v10.16.0-linux-x64/bin/node /opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
#22 57.61 npm ERR! gyp info it worked if it ends with ok
#22 57.61 npm ERR! gyp verb cli [ '/opt/node-v10.16.0-linux-x64/bin/node',
#22 57.61 npm ERR! gyp verb cli   '/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js',
#22 57.61 npm ERR! gyp verb cli   'rebuild',
#22 57.61 npm ERR! gyp verb cli   '--verbose',
#22 57.61 npm ERR! gyp verb cli   '--libsass_ext=',
#22 57.61 npm ERR! gyp verb cli   '--libsass_cflags=',
#22 57.61 npm ERR! gyp verb cli   '--libsass_ldflags=',
#22 57.61 npm ERR! gyp verb cli   '--libsass_library=' ]
#22 57.61 npm ERR! gyp info using node-gyp@7.1.2
#22 57.61 npm ERR! gyp info using node@10.16.0 | linux | x64
#22 57.61 npm ERR! gyp verb command rebuild []
#22 57.61 npm ERR! gyp verb command clean []
#22 57.61 npm ERR! gyp verb clean removing "build" directory
#22 57.61 npm ERR! gyp verb command configure []
#22 57.61 npm ERR! gyp verb find Python Python is not set from command line or npm configuration
#22 57.61 npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
#22 57.61 npm ERR! gyp verb find Python checking if "python3" can be used
#22 57.61 npm ERR! gyp verb find Python - executing "python3" to get executable path
#22 57.61 npm ERR! gyp verb find Python - "python3" is not in PATH or produced an error
#22 57.61 npm ERR! gyp verb find Python checking if "python" can be used
#22 57.61 npm ERR! gyp verb find Python - executing "python" to get executable path
#22 57.61 npm ERR! gyp verb find Python - "python" is not in PATH or produced an error
#22 57.61 npm ERR! gyp verb find Python checking if "python2" can be used
#22 57.61 npm ERR! gyp verb find Python - executing "python2" to get executable path
#22 57.61 npm ERR! gyp verb find Python - "python2" is not in PATH or produced an error
#22 57.62 npm ERR! gyp ERR! find Python
#22 57.62 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#22 57.62 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#22 57.62 npm ERR! gyp ERR! find Python checking if "python3" can be used
#22 57.62 npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
#22 57.62 npm ERR! gyp ERR! find Python checking if "python" can be used
#22 57.62 npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
#22 57.62 npm ERR! gyp ERR! find Python checking if "python2" can be used
#22 57.62 npm ERR! gyp ERR! find Python - "python2" is not in PATH or produced an error
#22 57.62 npm ERR! gyp ERR! find Python
#22 57.62 npm ERR! gyp ERR! find Python **********************************************************
#22 57.62 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#22 57.62 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#22 57.62 npm ERR! gyp ERR! find Python you can try one of the following options:
#22 57.62 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#22 57.62 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#22 57.62 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#22 57.62 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#22 57.62 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#22 57.62 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#22 57.62 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#22 57.62 npm ERR! gyp ERR! find Python **********************************************************
#22 57.62 npm ERR! gyp ERR! find Python
#22 57.62 npm ERR! gyp ERR! configure error
#22 57.62 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#22 57.62 npm ERR! gyp ERR! stack     at PythonFinder.fail (/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/lib/find-python.js:302:47)
#22 57.62 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/lib/find-python.js:136:21)
#22 57.62 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/lib/find-python.js:179:16)
#22 57.62 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/lib/find-python.js:266:16)
#22 57.62 npm ERR! gyp ERR! stack     at exithandler (child_process.js:301:5)
#22 57.62 npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:313:5)
#22 57.62 npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
#22 57.62 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
#22 57.62 npm ERR! gyp ERR! stack     at onErrorNT (internal/child_process.js:415:16)
#22 57.62 npm ERR! gyp ERR! stack     at process._tickCallback (internal/process/next_tick.js:63:19)
#22 57.62 npm ERR! gyp ERR! System Linux 5.4.72-microsoft-standard-WSL2
#22 57.62 npm ERR! gyp ERR! command "/opt/node-v10.16.0-linux-x64/bin/node" "/opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
#22 57.62 npm ERR! gyp ERR! cwd /opt/node-v10.16.0-linux-x64/lib/node_modules/node-sass
#22 57.62 npm ERR! gyp ERR! node -v v10.16.0
#22 57.62 npm ERR! gyp ERR! node-gyp -v v7.1.2
#22 57.62 npm ERR! gyp ERR! not ok
#22 57.62 npm ERR! Build failed with error code: 1
#22 57.89
#22 57.89 npm ERR! A complete log of this run can be found in:
#22 57.89 npm ERR!     /root/.npm/_logs/2021-07-09T10_06_58_380Z-debug.log
------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c /usr/bin/npm install npm@latest -g  && /usr/bin/npm install --unsafe-perm -g node-sass  && /usr/bin/npm install -g @angular/cli]: exit code: 1

It is probably a duplicate of #5, but indeed I have had experience with such kind of problem related to node-sass. Shortly, both nodejs and node-sass must be kept up to date simultaneously. I used the master branch, so I could not exactly find where the change was committed.

We would like to provide additional fix. I suggest to upgrade to node 14 and check if node-sass is definitely required or not. And, in such case, provide/force the matching version. At the moment I am writing, I don't even know if node-sass is even required for the build. A number of projects I have seen do not really depend on node-sass despite having it in the devDependencies.