0

I using node version 16.16.0 and npm version 8.11.0

I'm currently accessing a vue project on my local. So I need to run npm install. This vue project version: v2.6.11. When I run npm install there is an error like this:

npm ERR! code 1
npm ERR! path /Users/secret/my-app/node_modules/grpc
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.14.0
npm ERR! node-pre-gyp info using node@16.16.0 | darwin | x64
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download 
npm ERR! node-pre-gyp info check checked for "/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown/grpc_node.node" (not found)
npm ERR! node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-darwin-x64-unknown.tar.gz
npm ERR! node-pre-gyp http 404 https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-darwin-x64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-darwin-x64-unknown.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not found for grpc@1.24.2 and node@16.16.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) 
npm ERR! node-pre-gyp http 404 status code downloading tarball https://node-precompiled-binaries.grpc.io/grpc/v1.24.2/node-v93-darwin-x64-unknown.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | darwin | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.16.0 | darwin | x64
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration
npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON
npm ERR! gyp ERR! find Python checking if "python3" can be used
npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error
npm ERR! gyp ERR! find Python checking if "python" can be used
npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error
npm ERR! gyp ERR! find Python 
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python You need to install the latest version of Python.
npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
npm ERR! gyp ERR! find Python you can try one of the following options:
npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python   (accepted by both node-gyp and npm)
npm ERR! gyp ERR! find Python - Set the environment variable PYTHON
npm ERR! gyp ERR! find Python - Set the npm configuration variable python:
npm ERR! gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
npm ERR! gyp ERR! find Python For more information consult the documentation at:
npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
npm ERR! gyp ERR! find Python **********************************************************
npm ERR! gyp ERR! find Python 

npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Python installation to use
npm ERR! gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47)
npm ERR! gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21)
npm ERR! gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16)
npm ERR! gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16)
npm ERR! gyp ERR! stack     at exithandler (node:child_process:406:5)
npm ERR! gyp ERR! stack     at ChildProcess.errorhandler (node:child_process:418:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
npm ERR! gyp ERR! stack     at onErrorNT (node:internal/child_process:478:16)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
npm ERR! gyp ERR! cwd /Users/secret/my-app/node_modules/grpc
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok 
npm ERR! node-pre-gyp ERR! build error 
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/secret/my-app/node_modules/grpc/src/node/extension_binary/node-v93-darwin-x64-unknown --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/secret/my-app/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)

npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.5.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/secret/my-app/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
npm ERR! node-pre-gyp ERR! cwd /Users/secret/my-app/node_modules/grpc
npm ERR! node-pre-gyp ERR! node -v v16.16.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.14.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /Users/secret/.npm/_logs/2022-08-14T14_16_28_436Z-debug-0.log

Do I need to change version from node and npm to old version?

Please help. Thank you very much

  • You need Python and build tools - there’s a native component that needs to be compiled – Joe Aug 14 '22 at 14:37
  • @Joe I had install Python but there still exist error `npm ERR! node-pre-gyp ERR! not ok` – positive developer Aug 14 '22 at 15:29
  • Python and node-pre-gyp is needed to compile binaries from Node deps. This isn't needed under normal circumstances. This almost certainly means that you use a project with incompatible system or Node version (16). The question doesn't contain exhaustive info on it, but it's likely that it's Vue CLI and incompatible node-sass package that causes this. If that's the case, consider marking the question as a dupe. – Estus Flask Aug 14 '22 at 16:07
  • @EstusFlask there are lots of node modules that have native runtime dependencies, not sure why you say it's incompatible. Not true. `grpc` always has a native compile (or native binary piece) To the OP: can you post the new message? you may be missing other tools. – Joe Aug 14 '22 at 17:28
  • The error will be in the stack. If you see `Error: Could not find any Python installation to use` you don't have Python installed or in the path. It could be other errors due to other missing build-time dependencies for native modules – Joe Aug 14 '22 at 17:31
  • @Joe Now it works. I using nvm to switch the version node to version 14 – positive developer Aug 14 '22 at 17:54
  • @Joe Because this is Vue frontend project, this tremendously limits possible suspects, with node-sass being the constant PITA. gprc is server-side. Generally deps that involve binaries are precompiled. With rare exceptions, that a dep needs a compiler on install means that Node+platform combo is beyond expected values and possibly incompatible with this dep – Estus Flask Aug 14 '22 at 18:59

0 Answers0