Skip to content

SyntaxError: Unexpected token 'export' #384

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

Closed
jvdeijnden opened this issue Jun 24, 2020 · 4 comments
Closed

SyntaxError: Unexpected token 'export' #384

jvdeijnden opened this issue Jun 24, 2020 · 4 comments

Comments

@jvdeijnden
Copy link

When building for production and trying to run the development server, this happens:

FATAL  Unexpected token 'export'

  export default {
  ^^^^^^

  SyntaxError: Unexpected token 'export'
  at Object.compileFunction (vm.js:341:18)
  at Generator.next (<anonymous>)


   ╭────────────────────────────────────────────╮
   │                                            │
   │   ✖ Nuxt Fatal Error                       │
   │                                            │
   │   SyntaxError: Unexpected token 'export'   │
   │                                            │
   ╰────────────────────────────────────────────╯

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.

Project settings
? Project name: test
? Programming language: TypeScript
? Package manager: Npm
? UI framework: Buefy
? Nuxt.js modules: Axios, Progressive Web App (PWA), Content
? Linting tools: ESLint
? Testing framework: Jest
? Rendering mode: Universal (SSR / SSG)
? Deployment target: Server (Node.js hosting)
? Development tools: jsconfig.json (Recommended for VS Code)

To reproduce
run npm run build
run npm run dev

Expected behavior
I'm expecting the same thing to happen with a JavaScript project, which is compiling for and running the development server.

I have tried deleting the dist directory, but that doesn't fix it.

@kevinmarrec
Copy link
Contributor

kevinmarrec commented Jul 2, 2020

@jvdeijnden It is not reproducible, I've setup a project with exactly same options you selected (using npx create-nuxt-app test), and npm run build & npm run dev work both fine.

If you find a reproduction, please submit it around the https://github.com/nuxt/create-nuxt-app repository.

@indus
Copy link

indus commented Jul 3, 2020

I'm facing the same issue. I would guess it is related to TypeScript.

@daniluk4000
Copy link

Same issue with nuxt-ts only, nuxt works fine

@kevinmarrec
Copy link
Contributor

It should have been fixed with [email protected], following nuxt/create-nuxt-app#568 which fixed an issue regarding wrong package.json dev script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants