在Mean stack中开发时,我有以下错误:找不到模块' mongojs'

发布于 2025-01-31 08:32:15 字数 1096 浏览 4 评论 0原文

我运行命令:node Server在Ubuntu上的bash中,我遇到的错误是:

    node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'mongojs'
Require stack:
- /home/nishil/Documents/contactListApp/server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/nishil/Documents/contactListApp/server.js:5:15)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/nishil/Documents/contactListApp/server.js' ]
}

如何解决此错误?

I ran command: node server in bash on Ubuntu and below is the error I got:

    node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'mongojs'
Require stack:
- /home/nishil/Documents/contactListApp/server.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/nishil/Documents/contactListApp/server.js:5:15)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/nishil/Documents/contactListApp/server.js' ]
}

How can I resolve this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

故事与诗 2025-02-07 08:32:15

请访问您的软件包。
如果是删除软件包锁。

如果未安装mongojs,则可以使用npm i mongojs命令来执行此操作

,但我建议请将您的软件包从mongojs更改为 mongodb

因为Mongojs自上过去3年以来没有更新,它已经超过了27年的开放时间从很长的时间开始的问题。

让我知道该解决方案是否适合您。

Please check in your package.json file if mongojs is installed or not.
If it is then remove package-lock.json and remove node_modules folder and install node modules again by npm i.

If mongojs is not installed then you can do that using npm i mongojs command

But i would suggest please change your package from mongojs to mongodb https://www.npmjs.com/package/mongodb

As mongojs is seems outdated its not updated since last 3 years it has 27 open issues since very long.

Let me know if this solutions works for you..

战皆罪 2025-02-07 08:32:15

如果要使用Mongojs或任何其他模块,请确保它在包装中。JSON和您在包含包装的该目录中运行纱线安装或NPM安装。如果问题仍然存在,请尝试在此目录中删除Node_modules文件夹,然后尝试运行YARN安装或再次安装NPM。

If you want to use mongojs or any other module, please make sure it's there in package.json and you have run yarn install or npm install in that directory containing the package.json. If the problem still persists, try deleting the node_modules folder in this directory and try running yarn install or npm install again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文