ubuntu 无法找到从“server/index.js”导入的包“/apollo-server-express

xvw2m8pv  于 2023-03-07  发布在  其他
关注(0)|答案(1)|浏览(129)

我尝试在我的digital ocean droplet上运行我的express服务器。我已经运行了npm install,但是当我运行npm run startServer时,我得到了错误:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/root/ti4-automation/node_modules/apollo-server-express/' imported from /root/ti4-automation/server/index.js
    at new NodeError (node:internal/errors:387:5)
    at legacyMainResolve (node:internal/modules/esm/resolve:316:9)
    at packageResolve (node:internal/modules/esm/resolve:896:14)
    at moduleResolve (node:internal/modules/esm/resolve:958:20)
    at defaultResolve (node:internal/modules/esm/resolve:1173:11)
    at nextResolve (node:internal/modules/esm/loader:173:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:852:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:439:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

我的startServer脚本执行"startServer": "nodemon ./server/index.js",
我的index.js

import { ApolloServer } from 'apollo-server-express'

在我的package.json中,我确实有
x1米6英寸x1米7英寸
当我导航到文件夹/root/ti4-automation/node_modules/apollo-server-express/时,我可以看到它在那里。
我还运行了以下代码:
x一米九氮一x〉x一米十氮一x
但是错误仍然存在。本地一切都按预期工作。

8ftvxx2r

8ftvxx2r1#

我选择了更高一层的droplet(从6$ p/m到7$ p/m),现在我没有任何问题。在以前的droplet中,我确实遇到了NPM安装第一次崩溃的问题。

相关问题