Closed ProchaLu closed 1 year ago
After adding Python to the Dockerfile with RUN apk add --no-cache python3 py3-pip
, when installing the dependencies of a project that contains the package libpg-query
the node-pre-gyp install --fallback-to-build
script command form libpg-query
is failing with this error message
.../node_modules/libpg-query install$ node-pre-gyp install --fallback-to-build
.../node_modules/libpg-query install: node-pre-gyp info it worked if it ends with ok
.../node_modules/libpg-query install: node-pre-gyp info using node-pre-gyp@1.0.10
.../node_modules/libpg-query install: node-pre-gyp info using node@18.16.0 | linux | arm64
.../node_modules/libpg-query install: node-pre-gyp info check checked for "/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release/queryparser.node" (not found)
.../node_modules/libpg-query install: node-pre-gyp http GET https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v15.0.2-node-v108-linux-arm64.tar.gz
.../node_modules/libpg-query install: node-pre-gyp ERR! install response status 404 Not Found on https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v15.0.2-node-v108-linux-arm64.tar.gz
.../node_modules/libpg-query install: node-pre-gyp WARN Pre-built binaries not installable for libpg-query@15.0.2 and node@18.16.0 (node-v108 ABI, musl) (falling back to source compile with node-gyp)
.../node_modules/libpg-query install: node-pre-gyp WARN Hit error response status 404 Not Found on https://supabase-public-artifacts-bucket.s3.amazonaws.com/libpg-query-node/queryparser-v15.0.2-node-v108-linux-arm64.tar.gz
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.3.1
.../node_modules/libpg-query install: gyp info using node@18.16.0 | linux | arm64
.../node_modules/libpg-query install: gyp info ok
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.3.1
.../node_modules/libpg-query install: gyp info using node@18.16.0 | linux | arm64
.../node_modules/libpg-query install: gyp info find Python using Python version 3.10.11 found at "/usr/bin/python3"
.../node_modules/libpg-query install: gyp http GET https://nodejs.org/download/release/v18.16.0/node-v18.16.0-headers.tar.gz
.../node_modules/libpg-query install: gyp http 200 https://nodejs.org/download/release/v18.16.0/node-v18.16.0-headers.tar.gz
.../node_modules/libpg-query install: gyp http GET https://nodejs.org/download/release/v18.16.0/SHASUMS256.txt
.../node_modules/libpg-query install: gyp http 200 https://nodejs.org/download/release/v18.16.0/SHASUMS256.txt
.../node_modules/libpg-query install: gyp info spawn /usr/bin/python3
.../node_modules/libpg-query install: gyp info spawn args [
.../node_modules/libpg-query install: gyp info spawn args '/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/libpg-query install: gyp info spawn args 'binding.gyp',
.../node_modules/libpg-query install: gyp info spawn args '-f',
.../node_modules/libpg-query install: gyp info spawn args 'make',
.../node_modules/libpg-query install: gyp info spawn args '-I',
.../node_modules/libpg-query install: gyp info spawn args '/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/config.gypi',
.../node_modules/libpg-query install: gyp info spawn args '-I',
.../node_modules/libpg-query install: gyp info spawn args '/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp/addon.gypi',
.../node_modules/libpg-query install: gyp info spawn args '-I',
.../node_modules/libpg-query install: gyp info spawn args '/root/.cache/node-gyp/18.16.0/include/node/common.gypi',
.../node_modules/libpg-query install: gyp info spawn args '-Dlibrary=shared_library',
.../node_modules/libpg-query install: gyp info spawn args '-Dvisibility=default',
.../node_modules/libpg-query install: gyp info spawn args '-Dnode_root_dir=/root/.cache/node-gyp/18.16.0',
.../node_modules/libpg-query install: gyp info spawn args '-Dnode_gyp_dir=/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp',
.../node_modules/libpg-query install: gyp info spawn args '-Dnode_lib_file=/root/.cache/node-gyp/18.16.0/<(target_arch)/node.lib',
.../node_modules/libpg-query install: gyp info spawn args '-Dmodule_root_dir=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query',
.../node_modules/libpg-query install: gyp info spawn args '-Dnode_engine=v8',
.../node_modules/libpg-query install: gyp info spawn args '--depth=.',
.../node_modules/libpg-query install: gyp info spawn args '--no-parallel',
.../node_modules/libpg-query install: gyp info spawn args '--generator-output',
.../node_modules/libpg-query install: gyp info spawn args 'build',
.../node_modules/libpg-query install: gyp info spawn args '-Goutput_dir=.'
.../node_modules/libpg-query install: gyp info spawn args ]
.../node_modules/libpg-query install: gyp info ok
.../node_modules/libpg-query install: gyp info it worked if it ends with ok
.../node_modules/libpg-query install: gyp info using node-gyp@9.3.1
.../node_modules/libpg-query install: gyp info using node@18.16.0 | linux | arm64
.../node_modules/libpg-query install: gyp ERR! build error
.../node_modules/libpg-query install: gyp ERR! stack Error: not found: make
.../node_modules/libpg-query install: gyp ERR! stack at getNotFoundError (/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:10:17)
.../node_modules/libpg-query install: gyp ERR! stack at /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:57:18
.../node_modules/libpg-query install: gyp ERR! stack at new Promise (<anonymous>)
.../node_modules/libpg-query install: gyp ERR! stack at step (/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:54:21)
.../node_modules/libpg-query install: gyp ERR! stack at /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:71:22
.../node_modules/libpg-query install: gyp ERR! stack at new Promise (<anonymous>)
.../node_modules/libpg-query install: gyp ERR! stack at subStep (/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:69:33)
.../node_modules/libpg-query install: gyp ERR! stack at /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/which/which.js:80:22
.../node_modules/libpg-query install: gyp ERR! stack at /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/isexe/index.js:42:5
.../node_modules/libpg-query install: gyp ERR! stack at /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/isexe/mode.js:8:5
.../node_modules/libpg-query install: gyp ERR! System Linux 5.10.76-linuxkit
.../node_modules/libpg-query install: gyp ERR! command "/usr/local/bin/node" "/root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release/queryparser.node" "--module_name=queryparser" "--module_path=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
.../node_modules/libpg-query install: gyp ERR! cwd /preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query
.../node_modules/libpg-query install: gyp ERR! node -v v18.16.0
.../node_modules/libpg-query install: gyp ERR! node-gyp -v v9.3.1
.../node_modules/libpg-query install: gyp ERR! not ok
.../node_modules/libpg-query install: node-pre-gyp ERR! build error
.../node_modules/libpg-query install: node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release/queryparser.node --module_name=queryparser --module_path=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
.../node_modules/libpg-query install: node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/preflight/repo-to-check/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.10/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
.../node_modules/libpg-query install: node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28)
.../node_modules/libpg-query install: node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
.../node_modules/libpg-query install: node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
.../node_modules/libpg-query install: node-pre-gyp ERR! System Linux 5.10.76-linuxkit
.../node_modules/libpg-query install: node-pre-gyp ERR! command "/usr/local/bin/node" "/preflight/repo-to-check/node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.10/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
.../node_modules/libpg-query install: node-pre-gyp ERR! cwd /preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query
.../node_modules/libpg-query install: node-pre-gyp ERR! node -v v18.16.0
.../node_modules/libpg-query install: node-pre-gyp ERR! node-pre-gyp -v v1.0.10
.../node_modules/libpg-query install: node-pre-gyp ERR! not ok
.../node_modules/libpg-query install: Failed to execute '/usr/local/bin/node /root/.cache/node/corepack/pnpm/8.3.1/dist/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release/queryparser.node --module_name=queryparser --module_path=/preflight/repo-to-check/node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
.../node_modules/libpg-query install: Failed
βELIFECYCLEβ Command failed with exit code 1.
at makeError (file:///preflight/node_modules/.pnpm/execa@7.1.1/node_modules/execa/lib/error.js:59:11)
at handlePromise (file:///preflight/node_modules/.pnpm/execa@7.1.1/node_modules/execa/index.js:124:26)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async executeCommand (file:///preflight/clone-and-preflight.js:15:30)
at async file:///preflight/clone-and-preflight.js:35:1 {
shortMessage: 'Command failed with exit code 1: pnpm install',
command: 'pnpm install',
escapedCommand: 'pnpm install',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: 'Lockfile is up to date, resolution step is skipped\n' +
'Progress: resolved 1, reused 0, downloaded 0, added 0\n' +
'Packages: +817\n' +
After adding Python to the Docker image, the build failed due to a missing make
command with the error message: .../node_modules/libpg-query install: gyp ERR! stack Error: not found: make
. To resolve this issue, the build-base
package was added. Rebuilding the Docker image, a new error was encountered stating that bash
was missing, preventing make from running. The bash
package was added, allowing the libpg-query
module to be built successfully.
After running this command locally, the Docker image was built successfully and Preflight was executed:
Cloning https://github.com/ProchaLu/portfolio-cms-test...
Installing dependencies...
Running Preflight...
π UpLeveled Preflight v2.1.11
[STARTED] All changes committed to Git
[STARTED] node_modules/ folder ignored in Git
[STARTED] No extraneous files committed to Git
[STARTED] No secrets committed to Git
[STARTED] Use single package manager
[COMPLETED] No extraneous files committed to Git
[STARTED] Project folder name matches correct format
[COMPLETED] Project folder name matches correct format
[STARTED] No dependency problems
[STARTED] Next.js project has sharp installed
[STARTED] No unused dependencies
[STARTED] No dependencies without types
[COMPLETED] Next.js project has sharp installed
[COMPLETED] No secrets committed to Git
[STARTED] GitHub repo has deployed project link under About
[COMPLETED] Use single package manager
[STARTED] ESLint
[COMPLETED] node_modules/ folder ignored in Git
[STARTED] Stylelint
[COMPLETED] All changes committed to Git
[STARTED] Prettier
[COMPLETED] No dependencies without types
[COMPLETED] Prettier
[STARTED] ESLint config is latest version
[COMPLETED] GitHub repo has deployed project link under About
[STARTED] Stylelint config is latest version
[COMPLETED] Stylelint
[STARTED] Preflight is latest version
[FAILED] Unused dependencies found:
[FAILED] * @ts-safeql/eslint-plugin
[FAILED] * libpg-query
[FAILED] Remove these dependencies by running the following command for each dependency:
[FAILED] β $ pnpm remove <dependency name here>
[COMPLETED] No dependency problems
[COMPLETED] ESLint config is latest version
[COMPLETED] Stylelint config is latest version
[COMPLETED] Preflight is latest version
[COMPLETED] ESLint
A) Ok, so the build dependencies is partially solved (still needs caching of the built dependencies so that libpg-query
is not built every time Drone runs)
B) But also, what about the other previous repos? They weren't reporting problems with unused dependencies before. What is causing this report now?
I was able to avoid the error for unused dependencies in Kathi's e-commerce store and portfolio when switching to pnpm
without updating ESLint to the latest version.
The preflight throws these errors:
β nextjs-ecommerce-store git:(main) β preflight
π UpLeveled Preflight v2.1.11
β All changes committed to Git
βΊ Some changes have not been committed to Git:
M package.json
D yarn.lock
?? pnpm-lock.yaml
β node_modules/ folder ignored in Git
β No extraneous files committed to Git
β No secrets committed to Git
β Use single package manager
βΊ package-lock.json or yarn.lock file committed to Git. Remove it with:
β $ git rm --cached <filename>
After you've removed it, you can delete the file with:
β $ rm <filename>
The presence of this file indicates that another package manager was used in addition to pnpm (eg. "npm install" or "yarn add" was
run). In order to avoid issues with the state of the pnpm-lock.yaml file, we suggest also forcing regeneration this file with the
following command:
β $ pnpm install --force
β Project folder name matches correct format
β No dependency problems
β GitHub repo has deployed project link under About
β ESLint
β Stylelint
β Prettier
β ESLint config is latest version
βΊ Your current version of the UpLeveled ESLint Config (4.1.6) is older than the latest version 4.1.8 - upgrade by running all lines of
the install instructions on https://www.npmjs.com/package/eslint-config-upleveled
β Stylelint config is latest version
βΊ The UpLeveled Stylelint Config has not been installed - please install using the instructions on
https://www.npmjs.com/package/eslint-config-upleveled
β Preflight is latest version
When I update to the latest version of ESLint, I get the unused dependency errors:
β nextjs-ecommerce-store git:(main) β preflight
π UpLeveled Preflight v2.1.11
β All changes committed to Git
βΊ Some changes have not been committed to Git:
M .eslintignore
M .eslintrc.cjs
M package.json
D pages/api/hello.js
M stylelint.config.cjs
M tsconfig.json
D yarn.lock
?? next.d.ts
?? pnpm-lock.yaml
β node_modules/ folder ignored in Git
β No extraneous files committed to Git
β No secrets committed to Git
β Use single package manager
βΊ package-lock.json or yarn.lock file committed to Git. Remove it with:
β $ git rm --cached <filename>
After you've removed it, you can delete the file with:
β $ rm <filename>
The presence of this file indicates that another package manager was used in addition to pnpm (eg. "npm install" or "yarn add" was
run). In order to avoid issues with the state of the pnpm-lock.yaml file, we suggest also forcing regeneration this file with the
following command:
β $ pnpm install --force
β Project folder name matches correct format
β No dependency problems
β Next.js project has sharp installed
β No unused dependencies
βΊ Unused dependencies found:
* @ts-safeql/eslint-plugin
* libpg-query
Remove these dependencies by running the following command for each dependency:
β $ pnpm remove <dependency name here>
β No dependencies without types
β GitHub repo has deployed project link under About
β ESLint
βΊ ESLint problems found in the following files:
app/cart/CartTable.tsx
app/page.tsx
app/products/page.js
Open these files in your editor - there should be problems to fix
β Stylelint
β Prettier
β ESLint config is latest version
β Stylelint config is latest version
β Preflight is latest version
Cool, so it's something with the changes in the ESLint config, I guess? What is causing it?
I've discovered that if I include a .env
file with the following variables:
PGHOST=xxxxxxxxxxxxxxxxxx
PGUSERNAME=xxxxxxxxxxxxxx
PGPASSWORD=xxxxxxxxxxxxxx
PGDATABASE=xxxxxxxxxxxxxx
then the project will make use of the libpg-query
and @ts-safeql/eslint-plugin
dependencies.
On the other hand, if I remove one of these variables, such as PGUSERNAME
, or don't even have a .env
file, then both libpg-query
and @ts-safeql/eslint-plugin
become unused dependencies.
Preflight with a .env
file:
β No dependency problems
Preflight without a .env
file:
β No unused dependencies
βΊ Unused dependencies found:
* @ts-safeql/eslint-plugin
* libpg-query
Remove these dependencies by running the following command for each dependency:
β $ pnpm remove <dependency name here>
@ProchaLu Since you mentioned offline you're considering splitting this issue into 2 parts, you can document this in this issue and then link to the new issue:
libpg-query
(and maybe other dependencies)libpg-query
and @ts-safeql/eslint-plugin
in the ESLint setup and database setup instructionsClosed in https://github.com/upleveled/preflight/pull/454
- cache
libpg-query
(and maybe other dependencies)
Moved this to:
When attempting to install
libpg-query
in the Preflight Docker container, the following error is encountered:When running
pnpm install
inside the Docker image, the installation oflibpg-query
is failing due to the dependency on Python. Specifically, it seems that thenode-gyp
package used bylibpg-query
is requiring Python.Locally, when installing ESLint, a script is being executed (
node_modules/.pnpm/libpg-query@15.0.2/node_modules/libpg-query: Running install script...
). Since we changed the install command for the Docker image frompnpm install --ignore-scripts
topnpm install
in this commit, the same script is being executed inside Docker as well.I also tried using the older Docker image by reverting the changes made in this commit, but the errors are the same.
I tested different portfolios from the Winter Cohort 2023 using
yarn
and found no issues with@ts-safeql/eslint-plugin
andlibpg-query
as unused dependencies. However, switching topnpm
and upgrading to the latest version of ESLint, I encountered the following Preflight message:I also tested Kathi's Next.js e-commerce store using both
yarn
andpnpm
. While there were no issues with the unused dependencies when usingyarn
, I encountered the same Preflight message after switching topnpm
and upgrading to the latest version of ESLint.