After upgrading to 9.3.4
, next build
errors with:
โฏ npm run build
> [email protected] 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
Project builds correctly.
9.3.4
v12.16.1
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 [email protected]
+ [email protected]
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
> [email protected] build /dev/my-project
> cross-env NEXT_TELEMETRY_DISABLED=1 next build
Creating an optimized production build
Compiled successfully.
Automatically optimizing pages
# ...
Please provide a full reproduction so that we can investigate.
@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?
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
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! [email protected] build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
Don't know why but
package-lock.json
, node_modules
, npm install
seems fix the thing. I successfully run next build
after that.
I can confirm this is an issue. Wonder how this could get through CI / CD.
This happens with next dev
as well
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 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.
@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.
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.
@andrewl913 FWIW, I'm not using GraphQL at all.
@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.
@mattcarlotta @andrewl913 Then why would it work with 9.3.3
? (unless it doesn't?)
@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
@nfantone if you have a chance, clone my repo and see if you still see the issue.
@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):
@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
@timneutkens @mattcarlotta @andrewl913 Didn't work for me.
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.
next build
fails in the exact same fashion my private project does.
Many thanks for getting this up, @andrewl913.
@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.
@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 [email protected]: 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.
> [email protected] 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 -)
> [email protected] postinstall /home/m6d/Desktop/next-9.3.4-reproduction/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> [email protected] 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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of apollo-cache@^1.3.2 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] requires a peer of apollo-client@^2.6.4 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/[email protected] 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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [email protected] (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: [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 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
> [email protected] 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 > [email protected]: 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 > [email protected]: 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 > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning next > @ampproject/toolbox-optimizer > css > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
warning next > @ampproject/toolbox-optimizer > css > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
[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.
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 " > [email protected]" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-cache@^1.3.2".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-link@^1.2.12".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-utilities@^1.3.2".
warning "react-apollo > @apollo/[email protected]" has unmet peer dependency "apollo-client@^2.6.4".
warning "react-apollo > @apollo/[email protected]" 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
@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.
@nfantone Try this with your private repo. Does the same issue occur?
@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?
For me the problem also happens when using yarn
@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:
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....
Here is what I did.... When installing next there was a warning :
npm WARN deprecated [email protected]: 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...
@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 [email protected]
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"
:
@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
I experience this as well.
@mattcarlotta Good stuff.
Adding an extra two cents here: in my case, it also installs mkdirp
and warns about it.
npm WARN deprecated [email protected]: 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
@[email protected] /dev/my-project
โโโฌ @next/[email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโฌ @npmcli/[email protected]
โ โ โโโ [email protected] deduped
โ โโโฌ [email protected]
โ โ โโโ [email protected] deduped
โ โโโ [email protected]
โ โโโฌ [email protected]
โ โโโ [email protected] deduped
โโโฌ [email protected]
โ โโโฌ @commitlint/[email protected]
โ โโโฌ @commitlint/[email protected]
โ โโโฌ @marionebl/[email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โ โโโฌ [email protected]
โ โ โโโฌ [email protected]
โ โ โโโฌ [email protected]
โ โ โโโ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
โโโฌ [email protected]
โ โโโฌ [email protected]
โ โโโ [email protected]
โ โโโฌ [email protected]
โ โโโฌ [email protected]
โ โ โโโ [email protected]
โ โโโ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโฌ [email protected]
โโโ [email protected]
โโโฌ [email protected]
โโโ [email protected] deduped
Seems like 0.5.4
it's a direct dependency on many popular packages, such as eslint
and webpack
.
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 ๐ค
Perhaps providing a package.lock.json in addition to the yarn.lock may solve this problem or perhaps adding [email protected] 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
.
One thing that you could potentially do is this: https://github.com/zeit/next.js/issues/11583#issuecomment-607825557
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).
@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.
@timneutkens
yarn.lock
andpackage-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
.
@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 to9.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 fornpm
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.
@focux Does adding mkdirp v0.5.4 (npm i -D [email protected]
) to your devDependencies
fix your issue? Or are you still getting the same compilation problem? Also, what does your package-lock.json
look like?
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.
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)
Figured out what's going on, sending a PR to fix
Most helpful comment
@timneutkens I believe I tracked down the issue to the
mkdirp
dependency. Specifically, how npm's registry resolves themkdirp
dependency to this repo, while the yarn registry resolvesmkdirp
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 theyarn.lock
may solve this problem or perhaps adding[email protected]
to next's package.jsondevDependencies
. Let me know how you wish to proceed. I can create a pull request if needed.Working example (use
npm i
oryarn
, both should compile without errors):https://github.com/mattcarlotta/next-9.3.4-reproduction
It appears, in andrew's case, that the

apollo
package requiresmkdir: "^1.0.3"
, while every other package, requiresmkdirp "^0.5.0"
: