NodeJS 找不到模块“grpc" [英] NodeJS cannot find module 'grpc'

查看:89
本文介绍了NodeJS 找不到模块“grpc"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的 raspberry pi 3 上运行一个 JS 脚本,但我一直回到一个似乎是grpc"模块的问题.

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.

我尝试按照 https://github.com/firebase 重新安装和重新构建 npm/firebase-tools/issues/442 该线程中建议的答案中有一些,但我一直返回到如下所示的相同错误消息.

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.

有没有人有在 raspberry pi 上的 JS 中运行 firbase 的经验,他们知道如何解决这个问题,当我在 JS 文件中连接到我的 firebase 时,这似乎只是一个问题.

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)

推荐答案

我的解决方法是首先使用以下方法从 pi 的库中删除我的 node_modules:

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

但仍然缺少 grpc 模块,但安装它:

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

sudo npm install grpc

为我解决了问题.

这篇关于NodeJS 找不到模块“grpc"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆