#Cannot find package 'global-agent' imported from entry.mjs
8 messages · Page 1 of 1 (latest)
root@4b3s:~/myfolder# node server.js
node:internal/errors:484
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'global-agent' imported from /root/myfolder/entry.mjs
at new NodeError (node:internal/errors:393:5)
at packageResolve (node:internal/modules/esm/resolve:860:9)
at moduleResolve (node:internal/modules/esm/resolve:909:20)
at defaultResolve (node:internal/modules/esm/resolve:1124:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424: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'
}
Node.js v18.12.1
root@4b3s:~/myfolder#
import { defineConfig } from "astro/config";
// https://astro.build/config
import node from "@astrojs/node";
// https://astro.build/config
export default defineConfig({
output: "server",
outDir: "./builds",
adapter: node({
mode: "standalone",
}),
build: {
format: "directory",
},
});
.
Have you installed your node dependencies using the --production flag in either yarn or npm, and is astro in devDependencies? In case yes, that's the problem.
Another possible cause is that you're trying to execute the application without the node_modules folder. It will not work.
No, I didn't use --production with any dependencies. And yes, I don't have node_modules on the vps, I'm not shipping 120mbs of files to my vps. Why doesn't astro node build just have a package.json?
Well, it currently does not support that, but someone came up with a work-around that you might be interested in.
Check https://discord.com/channels/830184174198718474/1041097262610264125
Awesome, thanks.