我正在尝试手动将payloadcms部署到azure web应用程序服务。我在本地运行“npm run build”并创建了 build 和 dist 文件夹。然后我通过 ftp 进入我们的服务器并将 build 和 dist 文件夹复制到 wwwroot。从那里我运行 node dist/server.js ,这会导致服务器上出现错误:
root@mosaic-pay_bd31a08ed4:/home/site/wwwroot# node dist/server.js
node:internal/modules/cjs/loader:1148
throw err;
^
Error: Cannot find module 'dotenv'
Require stack:
- /home/site/wwwroot/dist/server.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
at Module._load (node:internal/modules/cjs/loader:986:27)
at Module.require (node:internal/modules/cjs/loader:1233:19)
at Module.patchedRequire (/agents/nodejs/node_modules/diagnostic-channel/dist/src/patchRequire.js:16:46)
at Hook._require.Module.require (/agents/nodejs/node_modules/require-in-the-middle/index.js:167:34)
at require (node:internal/modules/helpers:179:18)
at Object.<anonymous> (/home/site/wwwroot/dist/server.js:42:32)
at Module._compile (node:internal/modules/cjs/loader:1358:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
at Module.load (node:internal/modules/cjs/loader:1208:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/home/site/wwwroot/dist/server.js' ]
}
根据我的理解,这就是运行手动部署有效负载所需的全部内容。我有什么遗漏的吗?