nuxt / create-nuxt-app

Create Nuxt.js App in seconds.
MIT License
3.48k stars 428 forks source link

fresh install not working : SyntaxError: Unexpected token { #951

Closed MathieuDerelle closed 2 years ago

MathieuDerelle commented 2 years ago

Version

create-nuxt-app v4.0.0

Steps to reproduce

✨  Generating Nuxt.js project in app
? Project name: app
? Programming language: TypeScript
? Package manager: Npm
? UI framework: Vuetify.js
? Nuxt.js modules: Axios - Promise based HTTP client, Progressive Web App (PWA)
? Linting tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)ESLint, Prettier, Lint staged files, StyleLint, Commitlint
? Testing framework: Jest
? Rendering mode: Universal (SSR / SSG)
? Deployment target: Server (Node.js hosting)
? Development tools: jsconfig.json (Recommended for VS Code if you're not using typescript), Semantic Pull Requests, Dependabot (For auto-updating dependencies, GitHub only)
? Continuous integration: GitHub Actions (GitHub only)
? What is your GitHub username? mathieuderelle
? Version control system: Git

What is Expected?

npm run dev to run without error

What is actually happening?

getting an error :

$ npm run dev

> app@1.0.0 dev /Users/mathieu/Documents/github/app
> nuxt

/Users/mathieu/Documents/github/app/node_modules/@nuxt/cli/dist/cli-index.js:603
  } catch { }
          ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mathieu/Documents/github/app/node_modules/@nuxt/cli/dist/cli.js:11:15)
MathieuDerelle commented 2 years ago

also happening with the bear minimum

create-nuxt-app v4.0.0
✨  Generating Nuxt.js project in app2
? Project name: app2
? Programming language: JavaScript
? Package manager: Npm
? UI framework: None
? Nuxt.js modules: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? Linting tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? Testing framework: None
? Rendering mode: Universal (SSR / SSG)
? Deployment target: Server (Node.js hosting)
? Development tools: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? What is your GitHub username? mathieuderelle
? Version control system: Git
MathieuDerelle commented 2 years ago

I've already spent a lot of time trying to solve this Finally decided to post an issue, and found the solution few minutes later... sorry for the bad post

nvm was not on the correct node version : was originally on 16, but was actually on 8...