Fix Remix.run builds on Cloudflare Pages
Lawrence Chen
Posted on January 26, 2022
If you encounter this error when building Remix.run for Cloudflare pages (as of 1/26/22):
npm ERR! gyp ERR! cwd /opt/buildhome/repo/node_modules/xxhash-addon
set the python version to 3.7 (versions >=3.6.0 should work) via environment variables.
PYTHON_VERSION=3.7
Full logs for indexing:
00:18:35.013 Initializing build environment. This may take up to a few minutes to complete
00:21:05.922 Success: Finished initializing build environment
00:21:05.922 Cloning repository...
00:21:07.556 Success: Finished cloning repository files
00:21:07.687 Installing dependencies
00:21:07.690 Python version set to 2.7
00:21:08.974 Downloading and installing node v17.4.0...
00:21:09.134 Downloading https://nodejs.org/dist/v17.4.0/node-v17.4.0-linux-x64.tar.xz...
00:21:09.382 Computing checksum with sha256sum
00:21:09.517 Checksums matched!
00:21:12.688 Now using node v17.4.0 (npm v8.3.1)
00:21:12.765 Started restoring cached build plugins
00:21:12.768 Finished restoring cached build plugins
00:21:12.902 Attempting ruby version 2.7.1, read from environment
00:21:13.978 Using ruby version 2.7.1
00:21:14.236 Using PHP version 5.6
00:21:14.269 5.2 is already installed.
00:21:14.275 Using Swift version 5.2
00:21:14.276 Started restoring cached node modules
00:21:14.279 Finished restoring cached node modules
00:21:14.623 Installing NPM modules using NPM version 8.3.1
00:21:42.392 npm ERR! code 1
00:21:42.393 npm ERR! path /opt/buildhome/repo/node_modules/xxhash-addon
00:21:42.395 npm ERR! command failed
00:21:42.395 npm ERR! command sh -c node-gyp rebuild --ensure
00:21:42.396 npm ERR! gyp info it worked if it ends with ok
00:21:42.396 npm ERR! gyp info using node-gyp@8.4.1
00:21:42.396 npm ERR! gyp info using node@17.4.0 | linux | x64
00:21:42.396 npm ERR! gyp ERR! find Python
00:21:42.396 npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
00:21:42.396 npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
00:21:42.397 npm ERR! gyp ERR! find Python checking if "python3" can be used
00:21:42.397 npm ERR! gyp ERR! find Python - executable path is "/usr/bin/python3"
00:21:42.397 npm ERR! gyp ERR! find Python - version is "3.5.2"
00:21:42.397 npm ERR! gyp ERR! find Python - version is 3.5.2 - should be >=3.6.0
00:21:42.397 npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
00:21:42.397 npm ERR! gyp ERR! find Python checking if "python" can be used
00:21:42.397 npm ERR! gyp ERR! find Python - executable path is "/opt/buildhome/python2.7/bin/python"
00:21:42.398 npm ERR! gyp ERR! find Python - version is "2.7.12"
00:21:42.398 npm ERR! gyp ERR! find Python - version is 2.7.12 - should be >=3.6.0
00:21:42.398 npm ERR! gyp ERR! find Python - THIS VERSION OF PYTHON IS NOT SUPPORTED
00:21:42.398 npm ERR! gyp ERR! find Python
00:21:42.398 npm ERR! gyp ERR! find Python **********************************************************
00:21:42.398 npm ERR! gyp ERR! find Python You need to install the latest version of Python.
00:21:42.399 npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
00:21:42.399 npm ERR! gyp ERR! find Python you can try one of the following options:
00:21:42.399 npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
00:21:42.399 npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm)
00:21:42.399 npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
00:21:42.399 npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
00:21:42.399 npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
00:21:42.399 npm ERR! gyp ERR! find Python For more information consult the documentation at:
00:21:42.399 npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
00:21:42.399 npm ERR! gyp ERR! find Python **********************************************************
00:21:42.399 npm ERR! gyp ERR! find Python
00:21:42.399 npm ERR! gyp ERR! configure error
00:21:42.399 npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
00:21:42.399 npm ERR! gyp ERR! stack at PythonFinder.fail (/opt/buildhome/.nvm/versions/node/v17.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
00:21:42.399 npm ERR! gyp ERR! stack at PythonFinder.runChecks (/opt/buildhome/.nvm/versions/node/v17.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
00:21:42.399 npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/opt/buildhome/.nvm/versions/node/v17.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:266:16)
00:21:42.399 npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/opt/buildhome/.nvm/versions/node/v17.4.0/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:297:7)
00:21:42.399 npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:390:7)
00:21:42.399 npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
00:21:42.399 npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1090:16)
00:21:42.399 npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
00:21:42.399 npm ERR! gyp ERR! System Linux 5.11.0-1027-azure
00:21:42.399 npm ERR! gyp ERR! command "/opt/buildhome/.nvm/versions/node/v17.4.0/bin/node" "/opt/buildhome/.nvm/versions/node/v17.4.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--ensure"
00:21:42.399 npm ERR! gyp ERR! cwd /opt/buildhome/repo/node_modules/xxhash-addon
00:21:42.399 npm ERR! gyp ERR! node -v v17.4.0
00:21:42.399 npm ERR! gyp ERR! node-gyp -v v8.4.1
00:21:42.399 npm ERR! gyp ERR! not ok
00:21:42.402
00:21:42.402 npm ERR! A complete log of this run can be found in:
00:21:42.402 npm ERR! /opt/buildhome/.npm/_logs/2022-01-26T08_21_15_159Z-debug-0.log
00:21:42.429 Error during NPM install
00:21:42.430 Failed: build command exited with code: 1
💖 💪 🙅 🚩
Lawrence Chen
Posted on January 26, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.