Open pi0 opened 1 year ago
I tested workarounds and after a little fix of syntax it works fine:
export default defineNitroConfig({
externals: { traceOptions: { base: process.cwd() } }
})
export default defineNuxtConfig({
nitro: {
externals: {
traceOptions: { base: process.cwd() }
}
}
})
IF you want to reporoduce that problem you can use free account at serv00.com
Thanks for confirming here @avkarenow. Yes, yes workaround should work as long as all your node_modules
reside within process.cwd.
Moving from https://github.com/nuxt/nuxt/issues/15700 and https://github.com/unjs/nitro/pull/941
When the Nitro externals plugin tries to trace packages using vercel/nft, the nft box tries to read all parcels up to the filesystem root in order to find packages since we specify root as
/
by default.This default is needed to support various
node_modules
from application layers and linked npm packages that are not within the project's workspace, root, or source directories but it makes an issue in the environments like servers with limited filesystem access.A possible solution for such environments, is to make sure you are not using external sources or linked npm packages and set this in nitro config:
nitro.config.ts:
nuxt.config.ts
In order to solve this issue, we need to either fix the vercel/nft to automatically suppress such issues (maybe with a warning?) or add support for multiple
node_modules
search path (multiplebase
values to supportbase: string | string[]
.Another (acceptable) fix in nitro without fixing upstream would be to find the most common
node_modules
path (modulesDir: ['/home/user/project/node_modules', '/home/package/node_modules']
to automatically set base as/home/user
).Reproduction: It is hard to make one. We might try to use stackblitz and a bash script to limit filesystem permissions not sure if possible or use a Docker container. In the meantime, it is rather an accepted current issue.