-
Hi! I'm moving the application to the server, but I'm getting an error ENOENT: no such file or directory, open 'public/assets/.vite/manifest.json'. I don't understand what else this error could be related to. Has anyone encountered a similar situation? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 5 replies
-
Hey! 👋🏻 Are you trying to deploy to production? |
Beta Was this translation helpful? Give feedback.
-
I cloned the entire project to the server and ran the build. But it didn't help; the same error occurred. |
Beta Was this translation helpful? Give feedback.
-
The following helped me: npx npm-check-updates -u |
Beta Was this translation helpful? Give feedback.
-
I'm encountering the same issue, I ran the commands above but that didn't help. The file seems to be in place and responds if accessed directly:
Also NODE_ENV is set to Production. The project was started from the API starter kit, but I later decided to add Vite, Inertia, Edge for the frontend, seems to all work well in my local but showing this error when deployed. Any ideas @RomainLanz @Sa1ch ? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I had to update the Vite configuration on file import { defineConfig } from '@adonisjs/vite'
import app from '@adonisjs/core/services/app'
const viteBackendConfig = defineConfig({
/**
* The output of vite will be written inside this
* directory. The path should be relative from
* the application root.
*/
buildDirectory: 'public/assets',
/**
* The path to the manifest file generated by the
* "vite build" command.
*/
manifestFile: `${app.inProduction ? 'build/' : ''}public/assets/.vite/manifest.json`,
/**
* Feel free to change the value of the "assetsUrl" to
* point to a CDN in production.
*/
assetsUrl: '/assets',
scriptAttributes: {
defer: true,
},
})
export default viteBackendConfig The key is to tell the |
Beta Was this translation helpful? Give feedback.
-
I've tried both methods but it doesn't work @GradeyCullins @Sa1ch @RomainLanz |
Beta Was this translation helpful? Give feedback.
-
Just in case it helps someone, I had the same issue caused by a problem with my PM2 config file. Basically, PM2 was running from the wrong root directory with the following config (which, at the time, was being started from a shared directory outside the code base: module.exports = {
apps: [
{
name: 'nodejs-app',
script: '/var/www/my.domain.com/current/build/bin/server.js',
instances: 'max',
exec_mode: 'cluster',
autorestart: true,
env: {
'NODE_ENV': 'production',
},
},
],
} I changed it to this to get it working. (Notice the "cwd" property) module.exports = {
apps: [
{
name: 'nodejs-app',
cwd: '/var/www/my.domain.com/current/build',
script: 'bin/server.js',
instances: 'max',
exec_mode: 'cluster',
autorestart: true,
env: {
'NODE_ENV': 'production',
},
},
],
} |
Beta Was this translation helpful? Give feedback.
The following helped me:
npx npm-check-updates -u
npm install