gpt4 book ai didi

node.js - CentOS, Node 找不到模块

转载 作者:行者123 更新时间:2023-12-04 19:36:30 25 4
gpt4 key购买 nike

我在我的 MacOS 上很好地运行了 index.js。
今天使用git&&Github将node项目部署到CentOS 7。
该项目向我显示了错误。node index.js我看到一个错误 Cannot find module 'Joi'npm list --depth=0

npm list --depth=0
nodeMongoVdily@1.0.0 /root/newNode
├── express@4.16.4
├── joi@14.3.1
└── mongoose@5.4.17

谁知道原因?

我在 Google 和 Stack Overflow 上搜索了半个小时。我没有发现任何东西可以解决这个错误。
Error: Cannot find module 'Joi'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15)
at Function.Module._load (internal/modules/cjs/loader.js:520:25)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/root/newNode/model/genre.js:2:13)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
at Module.require (internal/modules/cjs/loader.js:650:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (/root/newNode/routes/genre.js:5:29)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)

最佳答案

https://discuss.circleci.com/t/error-uncaughtexception-cannot-find-module-joi/24949/2

我找到了答案。

You wouldn’t believe but I change my code from
let Joi = require('Joi')
to
let joi = require('joi')
all small-case, surprisingly it fixed the build.
But I am guessing y it worked locally :thinking:

关于node.js - CentOS, Node 找不到模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55003584/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com