NodeJS cannot find module 'grpc'

血红的双手。 提交于 2019-12-12 20:26:36

问题


Im trying to run a JS script on my raspberry pi 3 but i keep returning to a problem which appears to be the "grpc" module.

i have tried reinstalling and rebulding npm following https://github.com/firebase/firebase-tools/issues/442 som of the proposed answers in this thread, but i keep returning to the same error message as shown below.

Does anyone have experience with firbase running in JS on raspberry pi who know how to fix this, it appears only to be a problem when i have the connection to my firebase in the JS file.

    module.js:557
    throw err;
    ^

Error: Cannot find module 'grpc'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/pi/itPDP2018/node_modules/@firebase/firestore/dist/index.node.cjs.js:10:12)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

回答1:


The fix for me was to first remove my node_modules from the pi's libary using:

sudo rm -rf node_modules

in my project folder. Then reinstalling the modules with

npm install

but still the grpc module was missing, but installing it with:

sudo npm install grpc

fixed the problem for me.



来源:https://stackoverflow.com/questions/50604566/nodejs-cannot-find-module-grpc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!