Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to NodeJS 14.15 LTS (fixes #10158) #10159

Merged
merged 6 commits into from
Oct 12, 2021
Merged

Switch to NodeJS 14.15 LTS (fixes #10158) #10159

merged 6 commits into from
Oct 12, 2021

Conversation

abitrolly
Copy link
Contributor

Fixes build failure in docker build that started two days ago after npm 8 released.

Uses npm versions that is provided by the image, and switches the image to 14.15 which is a minimum required by npm 8 in case it will be needed.

@di
Copy link
Member

di commented Oct 11, 2021

Running this locally results in the following for me:

#9 141.4 npm ERR! code 1
#9 141.4 npm ERR! path /opt/warehouse/src/node_modules/node-webcrypto-ossl
#9 141.5 npm ERR! command failed
#9 141.5 npm ERR! command sh -c node-gyp rebuild
#9 141.5 npm ERR! gyp info it worked if it ends with ok
#9 141.5 npm ERR! gyp info using node-gyp@8.2.0
#9 141.5 npm ERR! gyp info using node@14.15.5 | linux | x64
#9 141.5 npm ERR! gyp ERR! find Python
#9 141.5 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
#9 141.5 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
#9 141.5 npm ERR! gyp ERR! find Python checking if "python3" can be used
#9 141.5 npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python3"
#9 141.5 npm ERR! gyp ERR! find Python - version is "3.5.3"
#9 141.5 npm ERR! gyp ERR! find Python - version is 3.5.3 - should be >=3.6.0
#9 141.5 npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
#9 141.5 npm ERR! gyp ERR! find Python checking if "python" can be used
#9 141.5 npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python"
#9 141.5 npm ERR! gyp ERR! find Python - version is "2.7.13"
#9 141.5 npm ERR! gyp ERR! find Python - version is 2.7.13 - should be >=3.6.0
#9 141.5 npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
#9 141.5 npm ERR! gyp ERR! find Python
#9 141.5 npm ERR! gyp ERR! find Python **********************************************************
#9 141.5 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
#9 141.5 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#9 141.5 npm ERR! gyp ERR! find Python you can try one of the following options:
#9 141.5 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#9 141.5 npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
#9 141.5 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
#9 141.5 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
#9 141.5 npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#9 141.5 npm ERR! gyp ERR! find Python For more information consult the documentation at:
#9 141.5 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#9 141.5 npm ERR! gyp ERR! find Python **********************************************************
#9 141.5 npm ERR! gyp ERR! find Python
#9 141.5 npm ERR! gyp ERR! configure error
#9 141.5 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
#9 141.5 npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
#9 141.5 npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
#9 141.5 npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:266:16)
#9 141.5 npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:297:7)
#9 141.5 npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:299:7)
#9 141.5 npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
#9 141.5 npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
#9 141.5 npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
#9 141.5 npm ERR! gyp ERR! System Linux 5.10.47-linuxkit
#9 141.5 npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#9 141.5 npm ERR! gyp ERR! cwd /opt/warehouse/src/node_modules/node-webcrypto-ossl
#9 141.5 npm ERR! gyp ERR! node -v v14.15.5
#9 141.5 npm ERR! gyp ERR! node-gyp -v v8.2.0
#9 141.5 npm ERR! gyp ERR! not ok

Because:

$ docker run -it node:14.15 bash
root@94a560206924:/# python3 --version
Python 3.5.3

I think we should also update the lockfile with this change, the build also outputs:

#9 33.75 npm WARN old lockfile
#9 33.75 npm WARN old lockfile The package-lock.json file was created with an old version of npm,
#9 33.76 npm WARN old lockfile so supplemental metadata must be fetched from the registry.
#9 33.76 npm WARN old lockfile
#9 33.76 npm WARN old lockfile This is a one-time fix-up, please be patient...
#9 33.76 npm WARN old lockfile

.github/workflows/ci.yml Outdated Show resolved Hide resolved
Dockerfile Outdated Show resolved Hide resolved
Dockerfile.static Outdated Show resolved Hide resolved
abitrolly and others added 4 commits October 11, 2021 21:18
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
@abitrolly
Copy link
Contributor Author

@di did you catch this error on Dockerfile.static? Last commit should prevent it there as well.

@di
Copy link
Member

di commented Oct 11, 2021

I found it by running make serve which builds Dockerfile.static.

Last commit should prevent it there as well.

I don't see how the npm version changes the need for a different Python version? This is a sub-dependency of one of our dependencies, node-gyp.

@abitrolly
Copy link
Contributor Author

npm@8 updates node-gyp, see npm/rfcs#445 (comment)

@abitrolly
Copy link
Contributor Author

Rebased #10052 on top of this PR to show that the build is fixed.

@di di merged commit c0510f9 into pypi:main Oct 12, 2021
@di
Copy link
Member

di commented Oct 12, 2021

Looks like my issues in #10159 (comment) were due to docker-compose not immediately picking up these changes.

@abitrolly abitrolly deleted the nodejs-lts branch October 12, 2021 18:42
@abitrolly
Copy link
Contributor Author

@di I also had some problems with podman building images with old files. Not sure if it was me accidentally building from the wrong branch, but now I do extra checks that my changes are indeed there.

Could you also add hacktoberfest-accepted label to this PR? It will help me earn some swag. :D

domdfcoding pushed a commit to domdfcoding/warehouse that referenced this pull request Jun 7, 2022
* Switch to NodeJS 14.15 LTS (fixes pypi#10158)

* More finegrained Node version in CI

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>

* More finegrained Node version in static image

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>

* More finegrained Node version in web image

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>

* Use native `npm` version in static Node image

Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants