Next.js: Deployment Error on NOW

Created on 14 May 2018  Â·  11Comments  Â·  Source: vercel/next.js

Next.js version: 6.0.2

  1. Build a simple Next.js project by
mkdir next-test
cd next-test
npm init -y
npm install --save react react-dom next
  1. Add deploy scripts to package.json
  "scripts": {
    "dev": "next",
    "build": "next build",
    "start": "next start"
  }
  1. Deploy to NOW

Error shows up during the build log:

Deploying ~/projects/tmp/next-test under ###

Using Node.js 8.11.1 (default)
https://next-test-cqdudbobrb.now.sh [in clipboard] (sfo1) [5s]
Synced 9 files (306.47KB) [5s]
Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 3 main dependencies…
events.js:183
Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?

at Object.exports.decode (/snapshot/ace/node_modules/tar-stream/headers.js:270:43)
at Extract.onheader [as _onparse] (/snapshot/ace/node_modules/tar-stream/extract.js:120:39)
at Extract._write (/snapshot/ace/node_modules/tar-stream/extract.js:243:8)
at Extract._continue (/snapshot/ace/node_modules/tar-stream/extract.js:207:28)
at oncontinue (/snapshot/ace/node_modules/tar-stream/extract.js:64:10)
at Extract.onheader [as _onparse] (/snapshot/ace/node_modules/tar-stream/extract.js:128:7)
at Extract._write (/snapshot/ace/node_modules/tar-stream/extract.js:243:8)
at Extract._continue (/snapshot/ace/node_modules/tar-stream/extract.js:207:28)
at oncontinue (/snapshot/ace/node_modules/tar-stream/extract.js:64:10)
at Extract.ondrain (/snapshot/ace/node_modules/tar-stream/extract.js:84:5)
  throw er; // Unhandled 'error' event
  ^

â–˛ npm install

[email protected] postinstall /home/nowuser/src/node_modules/webpack/node_modules/uglifyjs-webpack-plugin
node lib/post_install.js

npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 682 packages in 7.522s
â–˛ npm run build

[email protected] build /home/nowuser/src
next build

â–˛ Snapshotting deployment
â–˛ Saving deployment image (10.8M)
Build completed
Verifying instantiation in sfo1

App runs fine on the server. Seems some libraries are missing on the now for next.

Most helpful comment

@TooTallNate not sure if related, (I haven't changed code in my project), but now npm packages I used randomly failed during the build stage in NOW.

the app still works and get deployed on the server.

Example 1: Error: Error parsing package.json for fsevents-1.2.3.tar

Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 10 main dependencies…
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Error: Error parsing package.json for fsevents-1.2.3.tar
at extract (/snapshot/ace/lib/extract.js:36:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
â–˛ npm install

Example 2: Error: Error parsing package.json for styled-components-3.2.6.tar

Synced 1 file (2.71KB) [5s]
Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 10 main dependencies…
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Error: Error parsing package.json for styled-components-3.2.6.tar
at extract (/snapshot/ace/lib/extract.js:36:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Building "[email protected]" remotely
â–˛ npm install

All 11 comments

I can't reproduce based on the steps provided 🤔

seems like you need to create a pages dir with index.js in it for it to start compiling / deploy.

add step 2.5

mkdir pages
echo "export default ()  =>  <div>hello</div>" >> pages/index.js

Already did while trying, otherwise Next would error out.

Now-CLI: v11.1.7
NodeJS: v10.1.0 and v8.11.1
NPM: v6
OS: MacOS

This is what I get when I try to deploy to now.
The code is synced to server and started to build but with errors in tar header

screen shot 2018-05-15 at 01 35 10

Deploying ~/projects/tmp/next-test under bbi
Using Node.js 8.11.1 (default)
https://next-test-ccnokyuyeq.now.sh [in clipboard] (sfo1) [2s]
Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 3 main dependencies…
^

Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
at Object.exports.decode (/snapshot/ace/node_modules/tar-stream/headers.js:270:43)
at Extract.onheader [as _onparse] (/snapshot/ace/node_modules/tar-stream/extract.js:120:39)
at Extract._write (/snapshot/ace/node_modules/tar-stream/extract.js:243:8)
at Extract._continue (/snapshot/ace/node_modules/tar-stream/extract.js:207:28)
at oncontinue (/snapshot/ace/node_modules/tar-stream/extract.js:64:10)
at Extract.onheader [as _onparse] (/snapshot/ace/node_modules/tar-stream/extract.js:128:7)
at Extract._write (/snapshot/ace/node_modules/tar-stream/extract.js:243:8)
at Extract._continue (/snapshot/ace/node_modules/tar-stream/extract.js:207:28)
events.js:183
at oncontinue (/snapshot/ace/node_modules/tar-stream/extract.js:64:10)
at Extract.ondrain (/snapshot/ace/node_modules/tar-stream/extract.js:84:5)
throw er; // Unhandled 'error' event
â–˛ npm install

@timneutkens Just tried it on a new server on Ubuntu.

NodeJS: v10.1.0 and v8.11.1
NPM: v6
OS: Ubuntu
NOW: v11.1.7

still seeing events.js:183 (unhandled 'error' event)
followed by Invalid tar header...

screen shot 2018-05-15 at 02 46 55

Hey there, I tweaked some knobs on the backend. Can you please try once again?

@TooTallNate works fine now. no more errors.

@TooTallNate not sure if related, (I haven't changed code in my project), but now npm packages I used randomly failed during the build stage in NOW.

the app still works and get deployed on the server.

Example 1: Error: Error parsing package.json for fsevents-1.2.3.tar

Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 10 main dependencies…
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Error: Error parsing package.json for fsevents-1.2.3.tar
at extract (/snapshot/ace/lib/extract.js:36:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
â–˛ npm install

Example 2: Error: Error parsing package.json for styled-components-3.2.6.tar

Synced 1 file (2.71KB) [5s]
Building…
â–˛ npm install
âś“ Using "package-lock.json"
⧗ Installing 10 main dependencies…
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Building "[email protected]" remotely
Error: Error parsing package.json for styled-components-3.2.6.tar
at extract (/snapshot/ace/lib/extract.js:36:11)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
Building "[email protected]" remotely
â–˛ npm install

problems went away now. no more npm building errors

@williamli @timneutkens I began seeing these errors during build step. Now version is 11.3.0, Next version is 6.1.1

> Building…
> â–˛ npm install
> âś“ Using "yarn.lock"
> ⧗ Installing 24 main dependencies…
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Building "[email protected]" remotely
> Error: Error parsing `package.json` for fsevents-1.2.4.tar
>     at extract (/snapshot/ace/lib/extract.js:36:11)
>     at <anonymous>
>     at process._tickCallback (internal/process/next_tick.js:188:7)
> Ignoring failed optional dependency "[email protected]"
> â–˛ yarn
> yarn install v1.7.0
> [1/4] Resolving packages...
> [2/4] Fetching packages...
> info [email protected]: The platform "linux"is incompatible with this module.
> info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
> [3/4] Linking dependencies...
> warning "@zeit/next-typescript > @babel/preset-typescript > @babel/[email protected]" has unmet peer dependency "@babel/[email protected]".
> warning "@zeit/next-typescript > @babel/[email protected]" has unmet peer dependency "@babel/[email protected]".
> warning "@zeit/next-typescript > @babel/preset-typescript > @babel/plugin-transform-typescript > @babel/[email protected]" has unmet peer dependency "@babel/[email protected]".
> warning " > [email protected]" has incorrect peer dependency "eslint@^4.19.1".
> warning "eslint-config-airbnb > [email protected]" has incorrect peer dependency "eslint@^4.19.1".
> [4/4] Building fresh packages...

I'm also getting the "Error: Error parsing package.json for fsevents" on now 11.3.0 and next 6.1.1. Fixed when I upgraded to now 11.3.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jesselee34 picture jesselee34  Â·  3Comments

wagerfield picture wagerfield  Â·  3Comments

swrdfish picture swrdfish  Â·  3Comments

rauchg picture rauchg  Â·  3Comments

DvirSh picture DvirSh  Â·  3Comments