nuxt: [2.4.0] [npm] Unexpected token error when running in dev
Version
Reproduction link
https://i-cannot-share-private-repos.com/
Steps to reproduce
- Upgrade a codebase to Nuxt 2.4.0.
- Run
nuxtto build for dev.
What is expected ?
It compiles and builds the web site.
What is actually happening?
It throws an error:
ERROR in ./.nuxt/router.js friendly-errors 12:33:55
Module parse failed: Unexpected token (9:24) friendly-errors 12:33:55
You may need an appropriate loader to handle this file type.
|
| var _c67eeace = function _c67eeace() {
> return interopDefault(import('../pages/about-us.vue'
| /* webpackChunkName: "pages/about-us" */
| ));
friendly-errors 12:33:55
@ ./.nuxt/index.js 8:0-43 64:19-31
@ ./.nuxt/client.js
@ multi eventsource-polyfill webpack-hot-middleware/client?reload=true&timeout=30000&ansiColors=&overlayStyles=&name=client&path=/__webpack_hmr/client ./.nuxt/client.js
Additional comments?
All I did was upgrade using npm install -D nuxt@2.4.0 to get the latest version. Not sure if there are other changes I need to make (nothing was mentioned in the release notes).
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 16 (10 by maintainers)
“ npm should either remove package-lock.json and reinstall before upgrade or use npm update acorn --depth 20 && npm dedupe after upgrading to 2.4.0.“ i remove node_modules, then remove package-lock.json, then update nuxt and reinstall, it’s work. only remove package-lock.json and reinstall it’s not useful to me. hope to help you.
PS: Alternative official module is style-resources-module
Upgrading to
nuxt@2.4.0and removingpackage-lock.jsonseems to have fixed the issue. But it seems that a module I usenuxt-sass-resources-loaderis not working anymore. Don’t know if it’s related to2.4.0.Do we have to use a module like this now?
This is probably related to webpack regression. Please remove
yarn.lock/package-lock.jsonand reinstall. This should fix the problem. (Originally discovered by @manniL few days ago)Link to the issue: https://github.com/webpack/webpack/issues/8656
Update
Alternative solution:
Related issue: #4839
I also have the same issue. I am using
nuxt@2.3.4. I just removed package.lock and reinstalled packages but the error still persists.