I've got a problem, I'm finally deploying a server-side nuxt app (with an express server) I've created to Heroku. The build succeeds but then when it tries to start it gives me:
2021-07-29T18:13:38.000000+00:00 app[api]: Build succeeded
2021-07-29T18:13:42.050534+00:00 heroku[web.1]: Process exited with status 1
2021-07-29T18:13:42.139623+00:00 heroku[web.1]: State changed from starting to crashed
2021-07-29T18:13:41.793565+00:00 app[web.1]:
2021-07-29T18:13:41.793587+00:00 app[web.1]: > nuxt-express@1.0.0 start /app
2021-07-29T18:13:41.793588+00:00 app[web.1]: > nuxt start
2021-07-29T18:13:41.793588+00:00 app[web.1]:
2021-07-29T18:13:41.814774+00:00 app[web.1]: sh: 1: nuxt: not found
2021-07-29T18:13:41.822159+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2021-07-29T18:13:41.822579+00:00 app[web.1]: npm ERR! syscall spawn
2021-07-29T18:13:41.822774+00:00 app[web.1]: npm ERR! file sh
2021-07-29T18:13:41.823001+00:00 app[web.1]: npm ERR! errno ENOENT
2021-07-29T18:13:41.834748+00:00 app[web.1]: npm ERR! nuxt-express@1.0.0 start: `nuxt start`
2021-07-29T18:13:41.834966+00:00 app[web.1]: npm ERR! spawn ENOENT
2021-07-29T18:13:41.835206+00:00 app[web.1]: npm ERR!
2021-07-29T18:13:41.835433+00:00 app[web.1]: npm ERR! Failed at the nuxt-express@1.0.0 start script.
I'm not sure where i'm going wrong with this. Do I have to build it before deploying with the Heroku cli? Is it a problem with my express server (since it's saying it failed at nuxt-express. I'm just not sure whats going on, if anyone could be of help it would greatly assist me! Thanks!
Here is my package.json if it helps:
{
"name": "p-live",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"heroku-postbuild": "npm run build"
},
"dependencies": {
"@nuxt/http": "latest",
"@nuxtjs/firebase": "^7.5.0",
"cookie-universal-nuxt": "^2.1.5",
"dotenv": "^10.0.0",
"express": "latest",
"firebase": "^8.3.1",
"jsforce": "^1.10.1",
"nuxt": "latest"
},
"devDependencies": {
"@nuxtjs/moment": "^1.6.1",
"@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/tailwindcss": "^3.4.2",
"@tailwindcss/custom-forms": "^0.2.1",
"@tailwindcss/postcss7-compat": "^2.0.3",
"autoprefixer": "^9.8.6",
"babel-eslint": "^10.1.0",
"eslint": "^7.20.0",
"eslint-plugin-nuxt": "^2.0.0",
"postcss": "^7.0.35",
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.3"
}
}
Try changing your start script to be a path to nuxt/bin
then provide the
Optionally if you still are having issues, consider adding the -c
flag with the relative path to your nuxt.config.js
file.
Do the same for build.
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"heroku-postbuild": "npm run build"
},
to
"scripts": {
"dev": "nuxt",
"build": "node_modules/nuxt/bin/nuxt.js build -c ./nuxt.config.js",
"start": "node_modules/nuxt/bin/nuxt.js start -c ./nuxt.config.js",
"generate": "nuxt generate",
"heroku-postbuild": "npm run build"
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.