我正在运行我的NodeJs应用程序,我收到一个错误.
sudo /usr/local/bin/node app.js
Error: Failed to load gRPC binary module because it was not installed for the current system
Expected directory: node-v57-linux-x64-glibc
Found: [node-v59-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current system
Original error: Cannot find module '/home/projects/kj_app/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc
/grpc_node.node'
at Object.<anonymous> (/home/projects/kj_app/node_modules/grpc/src/grpc_extension.js:53:17)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/projects/kj_app/node_modules/grpc/src/client.js:37:12)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
Run Code Online (Sandbox Code Playgroud)
编辑
sudo /usr/local/bin/npm rebuild
> protobufjs@6.8.6 postinstall /home/projects/kj_app/node_modules/protobufjs
> node scripts/postinstall
> grpc@1.10.1 install /home/projects/kj_app/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
[grpc] Success: "/home/projects/kj_app/node_modules/grpc/src/node/extension_binary/node-v59-linux-x64-glibc/grpc_node.node" al
ready installed
Pass --update-binary to reinstall or --build-from-source to recompile
> @google-cloud/profiler@0.1.14 install /home/projects/kj_app/node_modules/@google-cloud/profiler
> node-gyp rebuild
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build'
gyp ERR! System Linux 4.9.0-6-amd64
gyp ERR! command "/opt/bitnami/nodejs/bin/.node.bin" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "
rebuild"
gyp ERR! cwd /home/projects/kj_app/node_modules/@google-cloud/profiler
gyp ERR! node -v v9.8.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @google-cloud/profiler@0.1.14 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @google-cloud/profiler@0.1.14 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! /root/.npm/_logs/2018-04-10T16_06_40_444Z-debug.log
Run Code Online (Sandbox Code Playgroud)
Tnc*_*rei 17
好像您有一些Verion冲突
Expected directory: node-v57-linux-x64-glibc
Found: [node-v59-linux-x64-glibc]
Run Code Online (Sandbox Code Playgroud)
您是否尝试过在应用程序文件夹中运行npm rebuild?
我有同样的问题(使用nvm),发现我选择的节点版本不同于.nvmrc.我做了以下步骤来解决它:
rm -rf node_modules
nvm use
yarn
Run Code Online (Sandbox Code Playgroud)
我删除了node_modules,因为它可能已经为错误版本的节点安装了某些依赖项的版本,所以我想确保我有所选版本的正确库.
当我这样做时nvm use,它从.nvmrc我的项目中选择节点的版本.
你可以用npm install而不是yarn.这就是我的项目设置方式.
从节点6迁移到节点8后,Google Cloud Functions和Emulator遇到了相同的问题。
我的解决方案:
npm rebuild // 没有效果npm installnpm i --save firebase-functionsfirebase serve //启动模拟器并尝试您是否有机会在容器()上完成了npm install本地node-v59操作(node-v57)?grpc二进制文件是针对错误版本的节点的,因此是错误的。这通常在运行Linux Docker容器的本地Mac上发生。
Expected directory: node-v57-linux-x64-glibc
Found: [node-v59-linux-x64-glibc]
Run Code Online (Sandbox Code Playgroud)
该解决方案是rm -fr node_modules做npm install 容器。
| 归档时间: |
|
| 查看次数: |
22136 次 |
| 最近记录: |