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

Failed to compile after upgrading from 7 to 8 #6259

Closed
soffes opened this issue Feb 12, 2019 · 9 comments
Closed

Failed to compile after upgrading from 7 to 8 #6259

soffes opened this issue Feb 12, 2019 · 9 comments

Comments

@soffes
Copy link

soffes commented Feb 12, 2019

Bug report

ERROR  Failed to compile with 1 errors

 error  in ./node_modules/next/dist/client/next-dev.js

Module parse failed: Unexpected token (34:6)
You may need an appropriate loader to handle this file type.
| 
| 
> import('./noop');
| var _window = window,
|     assetPrefix = _window.__NEXT_DATA__.assetPrefix;

 @ multi ./node_modules/next/dist/client/next-dev

Describe the bug

Upgraded from 7 to 8 and now seeing this error. I don't really understand what the issue is or what I should do to fix it.

To Reproduce

$ git clone https://github.com/soffes/soff.es && cd soff.es
$ git checkout next-8
$ npm i && npm run dev

Expected behavior

It starts the development server.

System information

  • macOS 10.14.3 (18D109)
  • node 11.9.0
  • next 8.0.0
@lednhatkhanh
Copy link

lednhatkhanh commented Feb 12, 2019

same problem here with nextjs 8

Update: Change to use yarn instead of npm can workaround the problem

@dav-is
Copy link
Contributor

dav-is commented Feb 12, 2019

@soffes Sorry I didn't recognize the bug from your tweet 🤦‍♂️

It's a known issue with npm and a newer version of webpack.
#6167 (comment)

@dav-is dav-is closed this as completed Feb 12, 2019
@soffes
Copy link
Author

soffes commented Feb 12, 2019

The steps in that comment didn't work for me. I just removed webpack altogether and it started working.

@timneutkens
Copy link
Member

I just removed webpack altogether and it started working.

Did you have it in your dependencies or devDependencies, if so, why'd you add it? I'm really curious about that because I've seen users do that before and I'm still not sure why and it's potentially breaking in many ways 😬.

@soffes
Copy link
Author

soffes commented Feb 13, 2019

@blaiprat
Copy link

Had the same issue, in my case solved it by deleting node_modules and package-lock.json and installing everything again

@saltycrane
Copy link

For me, the solution was to remove @zeit/next-bundle-analyzer from my project. For reference, I created #6361

@coderavels
Copy link

I got this error following https://nextjs.org/learn/excel/lazy-loading-components.
I removed node_modules and package-lock.json. Removed @zeit/next-bundle-analyzer from dependencies. Then ran npm install. Ran npm install --save @zeit/next-bundle-analyzer.

Worked for me.

@jtomaszewski
Copy link
Contributor

jtomaszewski commented Apr 26, 2019

This is a problem of npm (of course) caused by acorn caused by webpack caused by updating next to 8.

Solution: webpack/webpack#8656 (comment)

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants