Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can no longer build with 9.3.4 #11583

Closed
nfantone opened this issue Apr 2, 2020 · 43 comments · Fixed by #11699
Closed

Can no longer build with 9.3.4 #11583

nfantone opened this issue Apr 2, 2020 · 43 comments · Fixed by #11699
Labels
please add a complete reproduction Please add a complete reproduction.

Comments

@nfantone
Copy link

nfantone commented Apr 2, 2020

Bug report

Describe the bug

After upgrading to 9.3.4, next build errors with:

❯ npm run build

> my-project@1.0.0 build /dev/my-project
> cross-env NEXT_TELEMETRY_DISABLED=1 next build

Creating an optimized production build  

Failed to compile.

./node_modules/next/dist/client/next.js
TypeError: invalid options argument
    at new Promise (<anonymous>)
    at Generator.throw (<anonymous>)


> Build error occurred
Error: > Build failed because of webpack errors
    at build (/dev/my-project/node_modules/next/dist/build/index.js:13:900)

I noticed that, for some reason, the actual line in which the error is thrown varies between runs of next build, seemingly at random. However, the error message is always the same.

For example:

Failed to compile.

./node_modules/next/dist/client/polyfills.js
TypeError: invalid options argument
Failed to compile.

./node_modules/next/dist/client/router.js
TypeError: invalid options argument

Expected behavior

Project builds correctly.

System information

  • OS: macOS Catalina 10.15.4 (19E266)
  • Version of Next.js: 9.3.4
  • Version of node: v12.16.1

Additional context

No other modifications were done or applied. All other dependencies remain the same in lockfile.

Reverting back to 9.3.3 solves the issue for me.

❯ npm remove next && npm i next@9.3.3

+ next@9.3.3
added 656 packages from 270 contributors and audited 1063442 packages in 27.174s

77 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

❯ npm run build

> my-project@1.0.0 build /dev/my-project
> cross-env NEXT_TELEMETRY_DISABLED=1 next build

Creating an optimized production build  

Compiled successfully.

Automatically optimizing pages  


# ...
@timneutkens timneutkens added the please add a complete reproduction Please add a complete reproduction. label Apr 2, 2020
@timneutkens
Copy link
Member

Please provide a full reproduction so that we can investigate.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@timneutkens Thanks for your reply. Unfortunately, this is happening for me in a private repo that I can't share as-is. I'll try to put together a minimal, reproducible example - but it's going to take some effort.

I was hoping some of you, more familiar with changes introduced in the latest patch release, would have a clue as to what may be causing this for users by acknowledging and digging up that particular error?

Nothing comes to mind?

@howks
Copy link
Contributor

howks commented Apr 2, 2020

Hi, I also have error after upgrading to 9.3.4

> next build

> Using external babel configuration
Creating an optimized production build

Failed to compile.

./node_modules/next/dist/client/polyfills.js
TypeError: invalid options argument
    at new Promise (<anonymous>)
    at Generator.throw (<anonymous>)


> Build error occurred
Error: > Build failed because of webpack errors
    at build (/node_modules/next/dist/build/index.js:13:900)
npm ERR! code ELIFECYCLE
npm ERR! errno 1

On version 9.3.3 everything works

@jundialwan
Copy link

jundialwan commented Apr 2, 2020

I do face the same problem with 9.3.4 but with different error message, see below.
Version 9.3.3 do me just fine.

> next build

Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://err.sh/next.js/built-in-css-disabled

Creating an optimized production build  

Failed to compile.

./src/pages/login.js
Error: Cannot find module 'find-cache-dir'


> Build error occurred
Error: > Build failed because of webpack errors
    at build ([XXXXXXXXXX]/node_modules/next/dist/build/index.js:13:900)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@1.0.15 build: `next build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the my-app@1.0.15 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     [XXXXXXXX]/.npm/_logs/2020-04-02T11_52_50_720Z-debug.log
Error: > Build failed because of webpack errors
  at build ([XXXXXXXXXX]/node_modules/next/dist/build/index.js:13:900)

^ This part precisely same as @howks @nfantone problem above

@jundialwan
Copy link

Don't know why but

  1. delete package-lock.json,
  2. delete node_modules,
  3. and then npm install

seems fix the thing. I successfully run next build after that.

@andrewl913
Copy link

andrewl913 commented Apr 2, 2020

I can confirm this is an issue. Wonder how this could get through CI / CD.

This happens with next dev as well

@timneutkens
Copy link
Member

timneutkens commented Apr 2, 2020

I'm not sure why none of these comments provide a complete reproduction which makes it impossible for us to help you / investigate the issue. If you do provide a complete reproduction we can more easily tell you what the problem is.

I'd be super happy to investigate deeper.

@timneutkens
Copy link
Member

@timneutkens Thanks for your reply. Unfortunately, this is happening for me in a private repo that I can't share as-is. I'll try to put together a minimal, reproducible example - but it's going to take some effort.

I was hoping some of you, more familiar with changes introduced in the latest patch release, would have a clue as to what may be causing this for users by acknowledging and digging up that particular error?

Nothing comes to mind?

Here are the release notes: https://github.com/zeit/next.js/releases/tag/v9.3.4

It's hard to say what exactly is the issue without having a complete reproduction as we can't investigate "run next build" as our integration test suite already covers "run next build" 50+ times in all kinds of situations.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@timneutkens

I'm not sure why none of these comments provide a complete reproduction which makes it impossible for us to help you / investigate the issue.

I understand your point - but seeing as there are now several of us facing the same problem, I'm not quite sure about this being "impossible to investigate".

I can't talk for others, but at least in my case, I suppose it would mean a comparable amount of effort going through changes and see which one could be causing a TypeError: invalid options argument for us vs. putting together an entire new repo/project trying to make it fail.

It's hard to say what exactly is the issue without having a complete reproduction as we can't investigate "run next build" as our integration test suite already covers "run next build" 50+ times in all kinds of situations.

I can absolutely see how this is true and tests are appreciated - however, again, being that this is clearly not an isolated issue and is affecting users after migration, there are some common cases tests are evidently not be covering.

Having said the above, I didn't mean to imply I won't share a reproducible example. I'm saying I don't have the time in my hands, right this moment, to set one up.

In the meantime, I'm happy to answer further questions to help clarify this.

@andrewl913
Copy link

andrewl913 commented Apr 2, 2020

https://github.com/andrewl913/next-9.3.4-reproduction here is a reproduction. Not tracking package.lock.json.

Edit: Some further insight, this could related to the intergration with Apollo.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@andrewl913 FWIW, I'm not using GraphQL at all.

@mattcarlotta
Copy link
Contributor

@andrewl913 Your repo is failing because it's missing a default export in _app.tsx:

import "intersection-observer";
import React from "react";
import App from "next/app";
class CoreApp extends App {
    public componentDidMount() {
        const { router: { query } } = this.props;
    }
    public render() {

        return (
          <div>
              hello
          </div>
        );
    }
}

export default CoreApp;

Fixing this issue, the app compiles as expected.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@mattcarlotta @andrewl913 Then why would it work with 9.3.3? (unless it doesn't?)

@andrewl913
Copy link

andrewl913 commented Apr 2, 2020

@mattcarlotta thanks for picking up on that. I fixed that and pushed. Error still happens for me . Node version 12.14.0. npm version 6.13.6

Edit: I still reproduced the issue with out the custom document and app components.
https://github.com/andrewl913/next-9.3.4-reproduction

@andrewl913
Copy link

@nfantone if you have a chance, clone my repo and see if you still see the issue.

@mattcarlotta
Copy link
Contributor

mattcarlotta commented Apr 2, 2020

@nfantone Your issue may be separate, but without a mwe, it's incredibly difficult and time consuming to track down what's causing your issue (a syntax error?, a third party dependency?, a problem with node?, a problem with your OS?) There are too many variables to consider without a reproducible example.

@andrewl913 Not seeing any compilation issues with your updated repo (running Node v10.19.0/npm 6.13.4):
repo

@timneutkens
Copy link
Member

@mattcarlotta thanks for picking up on that. I fixed that and pushed. Error still happens for me . Node version 12.14.0. npm version 6.13.6

Edit: I still reproduced the issue with out the custom document and app components.
https://github.com/andrewl913/next-9.3.4-reproduction

This seems to work fine, we have tests cases for this (basic typescript) that run on both linux and windows environments

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@timneutkens @mattcarlotta @andrewl913 Didn't work for me.

image

I didn't do anything besides cloning the repo, npm i, npm run dev. Can't say if it's the same underlying issue at this point, but this looks like a MWE to me.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

next build fails in the exact same fashion my private project does.

image

Many thanks for getting this up, @andrewl913.

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@mattcarlotta

Not seeing any compilation issues with your updated repo (running Node v10.19.0/npm 6.13.4).

Tried using your version of node and a different OS (previous errors were reported from macOS, now switched to Ubuntu). Same thing.

image

@mattcarlotta
Copy link
Contributor

mattcarlotta commented Apr 2, 2020

@nfantone @timneutkens I was able to reproduce the problem when using npm i/npm install to install dependencies, however, when using yarn install to install dependencies, then it compiles fine.

Ubuntu 18.04 LTS


Node v10.19.0/npm 6.13.4

Click to expand npm install example

npm install
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

core-js@2.6.11 postinstall /home/m6d/Desktop/next-9.3.4-reproduction/node_modules/babel-polyfill/node_modules/core-js
node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:

https://opencollective.com/core-js
https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

core-js@2.6.11 postinstall /home/m6d/Desktop/next-9.3.4-reproduction/node_modules/babel-runtime/node_modules/core-js
node -e "try{require('./postinstall')}catch(e){}"

core-js@3.6.4 postinstall /home/m6d/Desktop/next-9.3.4-reproduction/node_modules/core-js
node -e "try{require('./postinstall')}catch(e){}"

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN react-apollo@3.1.3 requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-common@3.1.3 requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-hoc@3.1.3 requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-components@3.1.3 requires a peer of apollo-cache@^1.3.2 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-components@3.1.3 requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/react-hooks@3.1.3 requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules/webpack/node_modules/fsevents/node_modules/abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/abbrev' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.abbrev.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules/webpack/node_modules/fsevents/node_modules/ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/ansi-regex' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules/webpack/node_modules/fsevents/node_modules/aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/aproba' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.aproba.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules/webpack/node_modules/fsevents/node_modules/balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/balanced-match' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.4 (node_modules/webpack/node_modules/fsevents/node_modules/chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/chownr' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.chownr.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules/webpack/node_modules/fsevents/node_modules/code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/code-point-at' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.code-point-at.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/concat-map):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/concat-map' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.concat-map.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules/webpack/node_modules/fsevents/node_modules/console-control-strings):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/console-control-strings' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.console-control-strings.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/core-util-is):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/core-util-is' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.core-util-is.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules/webpack/node_modules/fsevents/node_modules/deep-extend):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/deep-extend' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.deep-extend.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules/webpack/node_modules/fsevents/node_modules/delegates):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/delegates' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.delegates.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules/webpack/node_modules/fsevents/node_modules/detect-libc):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/detect-libc' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.detect-libc.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules/webpack/node_modules/fsevents/node_modules/fs.realpath):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/fs.realpath' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.fs.realpath.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/has-unicode):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/has-unicode' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.has-unicode.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules/webpack/node_modules/fsevents/node_modules/inherits):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/inherits' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.inherits.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules/webpack/node_modules/fsevents/node_modules/ini):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/ini' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.ini.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules/webpack/node_modules/fsevents/node_modules/isarray):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/isarray' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.isarray.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.5 (node_modules/webpack/node_modules/fsevents/node_modules/minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/minimist' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules/webpack/node_modules/fsevents/node_modules/ms):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/ms' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.ms.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/npm-normalize-package-bin):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/npm-normalize-package-bin' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.npm-normalize-package-bin.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/number-is-nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/number-is-nan' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.number-is-nan.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules/webpack/node_modules/fsevents/node_modules/object-assign):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/object-assign' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.object-assign.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/os-homedir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/os-homedir' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.os-homedir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/os-tmpdir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/os-tmpdir' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.os-tmpdir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/path-is-absolute):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/path-is-absolute' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.path-is-absolute.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/process-nextick-args):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/process-nextick-args' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.process-nextick-args.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules/webpack/node_modules/fsevents/node_modules/safe-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/safe-buffer' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.safe-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules/webpack/node_modules/fsevents/node_modules/safer-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/safer-buffer' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.safer-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules/webpack/node_modules/fsevents/node_modules/sax):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/sax' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.sax.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules/webpack/node_modules/fsevents/node_modules/semver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/semver' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.semver.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules/webpack/node_modules/fsevents/node_modules/set-blocking):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/set-blocking' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.set-blocking.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/signal-exit):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/signal-exit' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.signal-exit.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules/webpack/node_modules/fsevents/node_modules/strip-json-comments):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/strip-json-comments' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.strip-json-comments.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/util-deprecate):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/util-deprecate' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.util-deprecate.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules/webpack/node_modules/fsevents/node_modules/wrappy):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/wrappy' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.wrappy.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules/webpack/node_modules/fsevents/node_modules/yallist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/yallist' -> '/home/m6d/Desktop/next-9.3.4-reproduction/node_modules/webpack/node_modules/fsevents/node_modules/.yallist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 901 packages from 448 contributors and audited 12369 packages in 8.81s

24 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

m6d@m6d:~/Desktop/next-9.3.4-reproduction$ npm run dev

test-repo@1.0.0 dev /home/m6d/Desktop/next-9.3.4-reproduction
next dev -p 1203

[ wait ] starting the development server ...
[ info ] waiting on http://localhost:1203 ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()
[ wait ] compiling ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()
[ wait ] compiling ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()
[ wait ] compiling ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()
[ wait ] compiling ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()
[ wait ] compiling ...
[ error ] ./node_modules/next/dist/client/next-dev.js
TypeError: invalid options argument
at new Promise ()
at Generator.throw ()

yarn v.1.22.4

Click to expand yarn install example

yarn install
yarn install v1.22.4
info No lockfile found.
[1/4] Resolving packages...
warning apollo > git-parse > babel-polyfill > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning apollo > git-parse > babel-polyfill > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning next > @ampproject/toolbox-optimizer > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning next > @ampproject/toolbox-optimizer > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning next > @ampproject/toolbox-optimizer > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[2/4] Fetching packages...
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.12: The platform "linux" is incompatible with this module.
info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > react-apollo@3.1.3" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/react-common@3.1.3" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/react-common@3.1.3" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-cache@^1.3.2".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-link@^1.2.12".
warning "react-apollo > @apollo/react-components@3.1.3" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "react-apollo > @apollo/react-hoc@3.1.3" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/react-hooks@3.1.3" has unmet peer dependency "apollo-client@^2.6.4".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 6.02s.
m6d@m6d:~/Desktop/next-9.3.4-reproduction$ yarn dev
yarn run v1.22.4
$ next dev -p 1203
[ wait ]  starting the development server ...
[ info ]  waiting on http://localhost:1203 ...
[ info ]  bundled successfully, waiting for typecheck results...
[ wait ]  compiling ...
[ info ]  bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:1203
[ event ] build page: /
[ wait ]  compiling ...
[ info ]  bundled successfully, waiting for typecheck results...
[ ready ] compiled successfully - ready on http://localhost:1203

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@mattcarlotta Interesting. Can confirm it does work with yarn. Also noticed that it's only the deps installation that matters. If you run npm run dev after having installed modules with yarn, it also works.

image

@mattcarlotta
Copy link
Contributor

@nfantone Try this with your private repo. Does the same issue occur?

@nfantone
Copy link
Author

nfantone commented Apr 2, 2020

@mattcarlotta Indeed, it doesn't! Works fine with yarn. Good catch.

From what I've been gathering, there have been a lot of changes to package.json from 9.3.3 to 9.3.4.

Might some of them have anything to do with this?

@rmoedt
Copy link

rmoedt commented Apr 2, 2020

For me the problem also happens when using yarn

@mattcarlotta
Copy link
Contributor

mattcarlotta commented Apr 2, 2020

@nfantone Not that I can tell. All master/canary commits appear to be working when a local build is compiled/used in the example above. I'm leaning toward a possible npm registry issue?


You can try for yourself:

1.) Download the v9.3.4 commit from the master branch

2.) Unzip to desktop

3.) Open a new terminal and type:

cd ~/Desktop/next.js-e000d843b22b249a05d7ec949f55052d37a89a3a && yarn

and wait for it to compile and exit.

4.) In the next-9.3.4-reproduction repo, add this to the package.json dependencies in replace of next:

"next": "file:/home/m6d/Desktop/next.js-e000d843b22b249a05d7ec949f55052d37a89a3a/packages/next",

5.) Open a new terminal and type

cd ~/Desktop/next-9.3.4-reproduction && npm i && npm run dev

and it should compile the repo without having to use yarn install.

Result:
UiA4iBO.png

@jimbits
Copy link

jimbits commented Apr 2, 2020

I am now having the same issue. All of a sudden when I went to run next dev I got this error
./node_modules/next/dist/client/next.js

TypeError: invalid options argument
at new Promise ()
at Generator.throw ()

Everything was working fine then I went to add SVG support so I created a next.config.js and added svg support script for Webpack. Wen't to compile and that was it....

@jimbits
Copy link

jimbits commented Apr 2, 2020

Here is what I did.... When installing next there was a warning :

npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

It was about promises....hmmm ok.... It wanted me to upgrade to next9.3.4 to fix this when running npm audit.

I tried to update the mkdirp package but got the same error on running next dev.

I uninstall next and rolled back my next version to @9.3.1

next dev compiled...

@mattcarlotta
Copy link
Contributor

mattcarlotta commented Apr 2, 2020

@timneutkens I believe I tracked down the issue to the mkdirp dependency. Specifically, how npm's registry resolves the mkdirp dependency to this repo, while the yarn registry resolves mkdirp dependency to this repo. Swapping out the npm registry version (v1.0.3) for the yarn locked registry version (v0.5.4) seems to have fixed the issue.

Perhaps providing a package.lock.json in addition to the yarn.lock may solve this problem or perhaps adding mkdirp@0.5.4 to next's package.json devDependencies. Let me know how you wish to proceed. I can create a pull request if needed.

Working example (use npm i or yarn, both should compile without errors):
https://github.com/mattcarlotta/next-9.3.4-reproduction

It appears, in andrew's case, that the apollo package requires mkdir: "^1.0.3", while every other package, requires mkdirp "^0.5.0":
T7yQa5F

@scottie-schneider
Copy link

@mattcarlotta I've been struggling with this issue as well. My repo, based on the firebase hosting example: https://github.com/NextJS-Firebase/nextjs-firebase-hosting-template

@jacklaurencegaray
Copy link

I experience this as well.

@nfantone
Copy link
Author

nfantone commented Apr 3, 2020

@mattcarlotta Good stuff.

Adding an extra two cents here: in my case, it also installs mkdirp and warns about it.

npm WARN deprecated mkdirp@0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
❯ npm ls mkdirp
@my-project@1.0.0 /dev/my-project
├─┬ @next/bundle-analyzer@9.3.4
│ └─┬ webpack-bundle-analyzer@3.6.1
│   └── mkdirp@0.5.4 
├─┬ admin-lte@3.0.4
│ └─┬ summernote@0.8.16
│   └─┬ npm-check-updates@4.1.1
│     └─┬ pacote@11.1.4
│       ├─┬ @npmcli/git@2.0.1
│       │ └── mkdirp@1.0.3  deduped
│       ├─┬ cacache@15.0.0
│       │ └── mkdirp@1.0.3  deduped
│       ├── mkdirp@1.0.3 
│       └─┬ tar@6.0.1
│         └── mkdirp@1.0.3  deduped
├─┬ commitlint@8.3.5
│ └─┬ @commitlint/cli@8.3.5
│   └─┬ @commitlint/read@8.3.4
│     └─┬ @marionebl/sander@0.6.1
│       └── mkdirp@0.5.4 
├─┬ eslint@6.8.0
│ ├─┬ file-entry-cache@5.0.1
│ │ └─┬ flat-cache@2.0.1
│ │   └─┬ write@1.0.3
│ │     └── mkdirp@0.5.4 
│ └── mkdirp@0.5.4 
└─┬ next@9.3.4
  └─┬ webpack@4.42.0
    ├── mkdirp@0.5.4 
    ├─┬ terser-webpack-plugin@1.4.3
    │ └─┬ cacache@12.0.4
    │   ├── mkdirp@0.5.4 
    │   └─┬ move-concurrently@1.0.1
    │     ├─┬ copy-concurrently@1.0.5
    │     │ └── mkdirp@0.5.4 
    │     └── mkdirp@0.5.4 
    └─┬ watchpack@1.6.1
      └─┬ chokidar@2.1.8
        └─┬ fsevents@1.2.12
          └─┬ node-pre-gyp@0.14.0
            ├── mkdirp@0.5.3 
            └─┬ tar@4.4.13
              └── mkdirp@0.5.3  deduped

Seems like 0.5.4 it's a direct dependency on many popular packages, such as eslint and webpack.

@timneutkens
Copy link
Member

timneutkens commented Apr 5, 2020

So far this seems to be a bug in npm module resolution (unrelated to Next.js) as the issue does not surface when using yarn 🤔

@timneutkens
Copy link
Member

timneutkens commented Apr 5, 2020

Perhaps providing a package.lock.json in addition to the yarn.lock may solve this problem or perhaps adding mkdirp@0.5.4 to next's package.json devDependencies. Let me know how you wish to proceed. I can create a pull request if needed.

If yarn.lock and package-lock.json are published to the npm registry when a dependency like next is published. They are completely disregarded if you npm install next or yarn add next.

@timneutkens
Copy link
Member

One thing that you could potentially do is this: #11583 (comment)

rm -rf node_modules
rm package-lock.json
rm yarn.lock # this is not used by npm, but just to ensure consistency in CI
npm install

That would clean up your node_modules which could be in a bad state (because of that issue with the npm cli).

@nfantone
Copy link
Author

nfantone commented Apr 5, 2020

@timneutkens

So far this seems to be a bug in npm module resolution (unrelated to Next.js)

I get where you're coming from and while it appears to be tied to npm module resolution, I wouldn't say it's "unrelated to Next.js" as this didn't happen on any version prior to 9.3.4. Evidence shows that changes introduced lately triggered/surfaced this bug. They could/may still be reverted or reworked - unless you plan to drop support for npm entirely.

That would clean up your node_modules which could be in a bad state (because of that issue with the npm cli).

Apologies if I'm getting you wrong here, but if you're suggesting rm -rf node_modules -as per above- as a "workaround", it doesn't work. npm install would just mess things up again.

@nfantone
Copy link
Author

nfantone commented Apr 5, 2020

@timneutkens

yarn.lock and package-lock.json are published to the npm registry when a dependency like next is published.

Please, correct me if I'm wrong here - but I don't believe that's the case. Lockfiles are always ignored on npm publish.

image

@focux
Copy link

focux commented Apr 5, 2020

@timneutkens

So far this seems to be a bug in npm module resolution (unrelated to Next.js)

I get where you're coming from and while it appears to be tied to npm module resolution, I wouldn't say it's "unrelated to Next.js" as this didn't happen on any version prior to 9.3.4. Evidence shows that changes introduced lately triggered/surfaced this bug. They could/may still be reverted or reworked - unless you plan to drop support for npm entirely.

That would clean up your node_modules which could be in a bad state (because of that issue with the npm cli).

Apologies if I'm getting you wrong here, but if you're suggesting rm -rf node_modules -as per above- as a "workaround", it doesn't work. npm install would just mess things up again.

I think that the issue is not related to 9.3.4, I'm on 9.3.0 and I'm also getting this error. Also, I tried removing package-lock and node_modules and that didn't fix it.

@mattcarlotta
Copy link
Contributor

@focux Does adding mkdirp v0.5.4 (npm i -D mkdirp@0.5.4) to your devDependencies fix your issue? Or are you still getting the same compilation problem? Also, what does your package-lock.json look like?

@timneutkens
Copy link
Member

Please, correct me if I'm wrong here - but I don't believe that's the case. Lockfiles are always ignored on npm publish.

That's what I meant. Reworded my comment a bit.

@grikomsn
Copy link

grikomsn commented Apr 6, 2020

Tried @mattcarlotta's suggestion which downgrades mkdirp@^1.0.4 to mkdirp@^0.5.5 or below and using next@^9.3.4, build and deployment works without error. (reproduction)

An alternative solution is using the latest mkdirp but downgrade next@^9.3.4 to next@^9.3.3. (reproduction)

@timneutkens
Copy link
Member

Figured out what's going on, sending a PR to fix

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
please add a complete reproduction Please add a complete reproduction.
Projects
None yet
Development

Successfully merging a pull request may close this issue.