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

python is not configured in npm #3089

Open
unaccepted opened this issue Nov 6, 2024 · 4 comments
Open

python is not configured in npm #3089

unaccepted opened this issue Nov 6, 2024 · 4 comments

Comments

@unaccepted
Copy link

unaccepted commented Nov 6, 2024

The original issue is posted below which is related to setup of a node repo. While doing the setup I am facing issue with node-gyp and python.
citrineos/citrineos#45

@cclauss Can you please help here. I followed the thread #2664
But no luck. let me know if you need any other info to guide me better.

Below is the configuration of my system:

image image image image

I am getting this error while hitting the command on readme : "docker-compose -f ./docker-compose.yml up -d"

@cclauss
Copy link
Contributor

cclauss commented Nov 6, 2024

Please paste in text, not pictures. Pictures are not searchable or quotable but text is.

Your problem here is not related to Python. Python 3.11.2 was found at /usr/bin/python3 which works.

  • You can upgrade Python but it is not required -- brew install python

The problem is related to the FetchError.

@unaccepted
Copy link
Author

unaccepted commented Nov 6, 2024

Thanks @cclauss for the response, please find the reponse of the last command (docker-compose -f ./docker-compose.yml up -d) in text:

99.49 npm verbose reify failed optional dependency /usr/local/apps/citrineos/node_modules/bufferutil
99.60 npm info run [email protected] install { code: 1, signal: null }
99.60 npm verbose reify failed optional dependency /usr/local/apps/citrineos/node_modules/utf-8-validate
100.9 npm verbose stack Error: command failed
100.9 npm verbose stack at ChildProcess. (/usr/local/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
100.9 npm verbose stack at ChildProcess.emit (node:events:517:28)
100.9 npm verbose stack at maybeClose (node:internal/child_process:1098:16)
100.9 npm verbose stack at ChildProcess._handle.onexit (node:internal/child_process:303:5)
100.9 npm verbose pkgid [email protected]
100.9 npm verbose cwd /usr/local/apps/citrineos
100.9 npm verbose Linux 5.15.49-linuxkit-pr
100.9 npm verbose node v18.20.4
100.9 npm verbose npm v10.7.0
100.9 npm error code 1
100.9 npm error path /usr/local/apps/citrineos/node_modules/deasync
100.9 npm error command failed
100.9 npm error command sh -c node ./build.js
100.9 npm error gyp info it worked if it ends with ok
100.9 npm error gyp verb cli [
100.9 npm error gyp verb cli '/usr/local/bin/node',
100.9 npm error gyp verb cli '/usr/local/apps/citrineos/node_modules/.bin/node-gyp',
100.9 npm error gyp verb cli 'rebuild'
100.9 npm error gyp verb cli ]
100.9 npm error gyp info using [email protected]
100.9 npm error gyp info using [email protected] | linux | arm64
100.9 npm error gyp verb clean removing "build" directory
100.9 npm error gyp verb find Python Python is not set from command line or npm configuration
100.9 npm error gyp verb find Python Python is not set from environment variable PYTHON
100.9 npm error gyp verb find Python checking if "python3" can be used
100.9 npm error gyp verb find Python - executing "python3" to get executable path
100.9 npm error gyp verb find Python - executable path is "/usr/bin/python3"
100.9 npm error gyp verb find Python - executing "/usr/bin/python3" to get version
100.9 npm error gyp verb find Python - version is "3.11.2"
100.9 npm error gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
100.9 npm error gyp verb get node dir no --target version specified, falling back to host node version: 18.20.4
100.9 npm error gyp verb install input version string "18.20.4"
100.9 npm error gyp verb install installing version: 18.20.4
100.9 npm error gyp verb install --ensure was passed, so won't reinstall if already installed
100.9 npm error gyp verb install version not already installed, continuing with install 18.20.4
100.9 npm error gyp verb ensuring devDir is created /root/.cache/node-gyp/18.20.4
100.9 npm error gyp verb created devDir /root/.cache
100.9 npm error gyp http GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz
100.9 npm error gyp http fetch GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz attempt 1 failed with UNABLE_TO_GET_ISSUER_CERT_LOCALLY
100.9 npm error gyp WARN install got an error, rolling back install
100.9 npm error gyp verb remove using node-gyp dir: /root/.cache/node-gyp
100.9 npm error gyp verb remove removing target version: 18.20.4
100.9 npm error gyp verb remove removing development files for version: 18.20.4
100.9 npm error gyp ERR! configure error
100.9 npm error gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz failed, reason: unable to get local issuer certificate
100.9 npm error gyp ERR! stack at ClientRequest. (/usr/local/apps/citrineos/node_modules/minipass-fetch/lib/index.js:130:14)
100.9 npm error gyp ERR! stack at ClientRequest.emit (node:events:517:28)
100.9 npm error gyp ERR! stack at _destroy (node:_http_client:882:13)
100.9 npm error gyp ERR! stack at onSocketNT (node:_http_client:902:5)
100.9 npm error gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
100.9 npm error gyp ERR! System Linux 5.15.49-linuxkit-pr
100.9 npm error gyp ERR! command "/usr/local/bin/node" "/usr/local/apps/citrineos/node_modules/.bin/node-gyp" "rebuild"
100.9 npm error gyp ERR! cwd /usr/local/apps/citrineos/node_modules/deasync
100.9 npm error gyp ERR! node -v v18.20.4
100.9 npm error gyp ERR! node-gyp -v v10.2.0
100.9 npm error gyp ERR! not ok
100.9 npm error Build failed
100.9 npm verbose exit 1
100.9 npm verbose code 1
100.9
100.9 npm error A complete log of this run can be found in: /root/.npm/_logs/2024-11-06T13_20_43_352Z-debug-0.log
101.0 npm notice
101.0 npm notice New minor version of npm available! 10.7.0 -> 10.9.0
101.0 npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.9.0
101.0 npm notice To update run: npm install -g [email protected]
101.0 npm notice

failed to solve: process "/bin/sh -c npm run install-all && npm run build" did not complete successfully: exit code: 1

I have also created binding.gyp file with below content:

{ "targets": [ { "target_name": "binding", "sources": [ " /usr/local/bin/node" ] } ] }

Also note that I have Python 3.9.6 and not Python 3.11.2, I am assuming node-gyp might not be able to find with 'python' as I have python3. Do I need to tag python with python3 with some alias, I tried this also taking reference from some post, but still no luck.

amanjha@192 server % python3 --version
Python 3.9.6
amanjha@192 server % python --version
xcode-select: Failed to locate 'python', requesting installation of command line developer tools.
amanjha@192 server % which -a python
/usr/local/bin/python
amanjha@192 server % which -a python3
/usr/bin/python3
/opt/homebrew/bin/python3
/opt/homebrew/bin/python3
amanjha@192 server %

Earlier I tried below commands, but now I have reverted.

open ~/.zshrc

alias python3="/opt/homebrew/bin/python3"
export PYTHON="/opt/homebrew/bin/python3"

@cclauss
Copy link
Contributor

cclauss commented Nov 6, 2024

100.9 npm error gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"

Means that Python is NOT your problem.

Your problem is:

100.9 npm error gyp http fetch GET https://nodejs.org/download/release/v18.20.4/node-v18.20.4-headers.tar.gz attempt 1 failed with UNABLE_TO_GET_ISSUER_CERT_LOCALLY

@unaccepted
Copy link
Author

Thanks @cclauss for pointing out. I am using corporate laptop and it has zscalar so I might be running these behind a proxy. Is there a way to setup a my personal cert that node can use. Can you provide some reference.

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

No branches or pull requests

2 participants