install pulsar-client-node,but run node-pre-gyp install error
| Info | Note |
|---|---|
| System Info | Mac OS Monterey V12.4 Apple M1 |
| Node Info | 14.15.0 |
before i install pulsar-client-node,I follow pulsar-client doc and install that. it's no problem. but when i npm install in pulsar-client-node,it has something errors like this:
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
> [email protected] install /Users/jim/work/pulsar-client-node
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! install response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.7.0-rc.0-node-v83-darwin-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://pulsar.apache.org/docs/en/client-libraries-cpp/libpulsar-v1.7.0-rc.0-node-v83-darwin-x64.tar.gz
CC(target) Release/obj.target/nothing/node_modules/node-addon-api/nothing.o
LIBTOOL-STATIC Release/nothing.a
env: python: No such file or directory
make: *** [Release/nothing.a] Error 127
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/jim/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 21.5.0
gyp ERR! command "/Users/jim/.nvm/versions/node/v14.15.0/bin/node" "/Users/jim/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/jim/work/pulsar-client-node/build/Release/libpulsar.node" "--module_name=libpulsar" "--module_path=/Users/jim/work/pulsar-client-node/build/Release" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd /Users/jim/work/pulsar-client-node
gyp ERR! node -v v14.15.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/jim/.nvm/versions/node/v14.15.0/bin/node /Users/jim/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jim/work/pulsar-client-node/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/jim/work/pulsar-client-node/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/jim/work/pulsar-client-node/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 21.5.0
node-pre-gyp ERR! command "/Users/jim/.nvm/versions/node/v14.15.0/bin/node" "/Users/jim/work/pulsar-client-node/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/jim/work/pulsar-client-node
node-pre-gyp ERR! node -v v14.15.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.8
node-pre-gyp ERR! not ok
Failed to execute '/Users/jim/.nvm/versions/node/v14.15.0/bin/node /Users/jim/.nvm/versions/node/v14.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/jim/work/pulsar-client-node/build/Release/libpulsar.node --module_name=libpulsar --module_path=/Users/jim/work/pulsar-client-node/build/Release --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jim/.npm/_logs/2022-07-19T07_18_58_446Z-debug.log
when i update the node version to 16.16.0, it solve。 but other project needs the node version in 14.x.how can i solve this problem
@semi-xi, I ran into the same problem as you.
I solved it this way: https://gist.github.com/aleixmorgadas/6b07a3b63c0538724503c642b04340b4
In your scenario, I think might be an issue with the python version. You should be using python3.
Getting a similar error com node 12 and macos:
(package.json says it needs node > 10, so in theory it should work)
Command: node-pre-gyp install --fallback-to-build && node GenCertFile.js
Arguments:
Directory: /app/node_modules/pulsar-client
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | linux | arm64
node-pre-gyp info check checked for "/app/node_modules/pulsar-client/lib/binding/pulsar.node" (not found)
node-pre-gyp http GET https://archive.apache.org/dist/pulsar/pulsar-client-node/pulsar-client-node-1.9.0/napi-linux-glibc-arm64.tar.gz
node-pre-gyp info install unpacking binding/pulsar.node
node-pre-gyp info extracted file count: 1
node-pre-gyp info ok
[pulsar-client] Success: "/app/node_modules/pulsar-client/lib/binding/pulsar.node" is installed via remote
/app/node_modules/pulsar-client/src/Client.js:60
fs.rmSync(certsFilePath, { force: true });
^
TypeError: fs.rmSync is not a function
at Function.genCertFile (/app/node_modules/pulsar-client/src/Client.js:60:8)
at Object.<anonymous> (/app/node_modules/pulsar-client/GenCertFile.js:22:8)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)