Fly launch couldn't parse package.json error

This is the full error

[Error: Node.js engine package.json error]
Couldn't parse package.json: Could not parse package.json. missing field `name` at line 43 column 1
ERROR: failed to build: exit status 1
Error executing lifecycle: failed with status code: 51

I do not see any issues with my package.json and it deploys fine to heroku and vercel

Since I am on Mac Mini M1 I saw some posts about running it as follows

fly launch --remote-only but I get the same error

Line 43 which is it moaning about is the very last line in the package.json } the last closing bracket

  "private": true,
  "scripts": {
    "build": "nuxt build",
    "dev": "nuxt dev",
    "generate": "nuxt generate",
    "preview": "nuxt preview",
    "start": "node .output/server/index.mjs",
    "analyze": "nuxt build --analyze"
  "dependencies": {
    "@formkit/nuxt": "^1.0.0-beta.10",
    "@formkit/themes": "^1.0.0-beta.10",
    "@headlessui/vue": "^1.6.7",
    "@nuxt/image": "^0.7.1",
    "@nuxtjs/algolia": "^1.1.0",
    "@nuxtjs/google-fonts": "^3.0.0-0",
    "@nuxtjs/robots": "3.0.0-1",
    "@pinia/nuxt": "^0.3.1",
    "@supabase/supabase-js": "^1.35.4",
    "@tailwindcss/forms": "^0.5.2",
    "algoliasearch": "^4.14.2",
    "autoprefixer": "^10.4.7",
    "html-to-text": "^8.2.1",
    "instantsearch.js": "^4.43.1",
    "nodemailer": "^6.7.7",
    "npm": "^8.15.0",
    "pinia-plugin-persistedstate": "^1.6.3",
    "pug": "^3.0.2",
    "search-insights": "^2.2.1",
    "vue-instantsearch": "^4.4.2",
    "vue-toastification": "2.0.0-rc.5",
    "vue3-lottie": "^2.2.5"
  "devDependencies": {
    "@averjs/nuxt-compression": "^1.2.1",
    "@intlify/nuxt3": "^0.2.3",
    "@nuxtjs/tailwindcss": "^5.3.1",
    "nuxt": "3.0.0-rc.6",
    "postcss": "^8.4.14",
    "vue-cli-plugin-tailwind": "~3.0.0"

Hmm … Given it’s complaining about the name being missing … I’d think it may be worth adding a name (and a version field, while there). Since technically it is correct that the name is required (though it seems heroku and vercel don’t mind). Based on:

Maybe add a name and version, and try again. Shouldn’t matter. But it seems it does! :thinking:

As for the M1, I recall building on one used to be an issue (running builds locally) and so yes, in case it still is, worth using a remote builder to bypass that.

1 Like

Duh… I didn’t see the obvious. It was moaning about the package.json name.

I added that and the error is gone and it ran much better.

It failed again but gave an error about an incompatible npm plugin so I added engines to the package json to force the same node version range I am using locally.

"engines": {
    "node": ">=16.0.0 <17.0.0",

I see on the previous failure it logged

[Checking Node.js version]
Detected Node.js version range: *
Resolved Node.js version: 18.5.0

I think that version is too new for some of the packages.

Just waited for it to complete and it has worked!!

==> Creating release
Release v2 created

You can detach the terminal anytime without stopping the deployment
Monitoring Deployment

1 desired, 1 placed, 0 healthy, 0 unhealthy [health checks: 1 total, 
1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 1 total, 
1 desired, 1 placed, 1 healthy, 0 unhealthy [health checks: 1 total, 1 passing]
--> v0 deployed successfully

The page now loads :smiley: Finally some success!

Thanks for the help

1 Like