Netlify deploy throws: Error: Invalid version: "1"

Since yesterday I’m facing an error that I haven’t been able to fix or to find information about. I can build my site locally without errors but when I try to deploy it in Netlify it fails and throws:

8:19:33 AM: ​
8:19:33 AM: ┌─────────────────────────────┐
8:19:33 AM: │        Netlify Build        │
8:19:33 AM: └─────────────────────────────┘
8:19:33 AM: ​
8:19:33 AM: ❯ Version
8:19:33 AM:   @netlify/build 2.0.20
8:19:33 AM: ​
8:19:33 AM: ❯ Flags
8:19:33 AM:   deployId: 5efc2a7760231502ad0a057d
8:19:33 AM:   mode: buildbot
8:19:33 AM: ​
8:19:33 AM: ❯ Current directory
8:19:33 AM:   /opt/build/repo
8:19:33 AM: ​
8:19:33 AM: ❯ Config file
8:19:33 AM:   /opt/build/repo/netlify.toml
8:19:33 AM: ​
8:19:33 AM: ❯ Context
8:19:33 AM:   production
8:19:33 AM: ​
8:19:33 AM: ┌─────────────────────────────┐
8:19:33 AM: │     Core internal error     │
8:19:33 AM: └─────────────────────────────┘
8:19:33 AM: ​
8:19:33 AM:   Error message
8:19:33 AM:   Error: Invalid version: "1"
8:19:33 AM: ​
8:19:33 AM:   Error location
8:19:33 AM:       at Object.fixVersionField (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/fixer.js:191:13)
8:19:33 AM:       at /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/normalize.js:32:38
8:19:33 AM:       at Array.forEach (<anonymous>)
8:19:33 AM:       at normalize (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/normalize.js:31:15)
8:19:33 AM:       at module.exports (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/read-pkg/index.js:20:36)
8:19:33 AM:       at async module.exports (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/read-pkg-up/index.js:14:16)
8:19:33 AM:       at async getPackageJson (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/utils/package.js:7:22)
8:19:33 AM:       at async build (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/main.js:61:46)
8:19:33 AM:       at async runCli (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/core/bin.js:17:29)
8:19:33 AM: ​
8:19:33 AM:   Error properties
8:19:33 AM:   { name: 'Error' }
8:19:33 AM: ​
8:19:33 AM: Caching artifacts
8:19:33 AM: Started saving node modules
8:19:33 AM: Finished saving node modules
8:19:33 AM: Started saving build plugins
8:19:33 AM: Finished saving build plugins
8:19:33 AM: Started saving yarn cache
8:19:33 AM: Finished saving yarn cache
8:19:33 AM: Started saving pip cache
8:19:33 AM: Finished saving pip cache
8:19:33 AM: Started saving emacs cask dependencies
8:19:33 AM: Finished saving emacs cask dependencies
8:19:33 AM: Started saving maven dependencies
8:19:33 AM: Finished saving maven dependencies
8:19:33 AM: Started saving boot dependencies
8:19:33 AM: Finished saving boot dependencies
8:19:34 AM: Started saving go dependencies
8:19:35 AM: Finished saving go dependencies
8:19:39 AM: Error running command: Build script returned non-zero exit code: 1
8:19:39 AM: Failing build: Failed to build site
8:19:39 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
8:19:39 AM: Finished processing build request in 2m10.478232047s

It seems to be related with Node versions so I tried to fix by adding a .nvmrc but the error persists. Both (locally and Netlify) are running Node version 12.16.3.

Of course, I also tried to build with the cache cleaned.

The issue doesn’t provide much more information so I’m a bit lost.

Hey there!

Can you try updating the Node version env variable?

It’s done by adding the version .nvmrc isn’t? Which version should I use? According to Node latest stable version is the 12.18.3.

Technically, it’s either/or location! Only, I can say for certain that the env var isn’t dependant on a file location/path :slight_smile:

Our build image will support “Any version [of node] that nvm can install.”

Just out of interest, does the build fail if you don’t specify the version?

Yes, indeed, I wasn’t locking the Node version before I saw this error. Then I created the .nvmrc file and I used the same version that I saw in (v12.16.3):

Object.fixVersionField (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/fixer.js:191:13)
8:19:33 AM: at /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/normalize-package-data/lib/normalize.js:32:38

Spooky! I don’t suppose you can share the site name or a URL to a deploy log for us to dive in on?

It should be fixed in the next Netlify release according to https://github.com/netlify/build/issues/1608. In the meantime, it is fixed by changing the version field in the package.json. From 1 to 1.0.0.

That’s great – Micky’s such a source of knowledge. Thanks for closing the loop!