NuxtJS version 1.4.0
When using https://github.com/nuxt-community/starter-template, on npm run dev
I got
\test\node_modules\nuxt\lib\core\middleware\nuxt.js:72
const policies = this.options.render.csp.policies ? {...this.options.render.csp.policies} : null
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (\test\node_modules\nuxt\lib\core\renderer.js:19:24)
NuxtJS 1.3.0 works correctly.
Probably https://github.com/nuxt/nuxt.js/commit/a403205abe7e5c036c8aa3ee535e44c225ff2082 broken this
Shouldn't be an issue, because it's valid code. NodeJS >= 8.3 supports spread operators natively.
Which NodeJS version do you use?
I know that it's valid code, but I don't get why it's throwing exception.
And sorry, I forgot to write it, I using NodeJS v8.2.1 x64, so ...
is supported
Well, it's not (completely) as stated here. Shouldn't be an issue with a newer Node version.
did you put --harmony
flag, Mr. @gamelaster?
You should indeed use last stable version of node 8 @gamelaster, so at least 8.6 :)
I had this same issue when using Node 8.0.0
. This was resolved when upgrading to Node LTS 8.9.4
.
See issue https://github.com/nuxt-community/create-nuxt-app/issues/39
I'm having the same issue I even tried node v9.7.1(after trying node LTS 8.9.4) and I still get the same error
I'm now on
npm -> 5.7.1
node -> 9.7.1
@NaderJS I'm on Node v9.7.1 and it's working correctly
@gamelaster on which version of nuxt?
I tried nuxt 1.4 and 1.3 and its not working just a different error on 1.3.0 it says
const glob = promisify(Glob)
^
TypeError: promisify is not a function
at Object.
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
@gamelaster sounds like you need to rm -rf node_modules && npm install
@qm3ster I have latest nuxt installed, but didn't you wanted to mention @NaderJS ? I don't have any problem after upgrading to latest Node
I have extreme atmention dyslexia.
Probably gonna die.
To be fair, we all would benefit from rm -rf node_modules && npm install
from time to time. So no harm no foul.
Same issue here.
/home/xxxxx/Projects/my-project/node_modules/nuxt/lib/core/middleware/nuxt.js:72
const policies = this.options.render.csp.policies ? {...this.options.render.csp.policies} : null
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/xxxxx/Projects/my-project/node_modules/nuxt/lib/core/renderer.js:19:24)
npm version: 5.7.1
nodejs version: 8.9.4
Cheers
@template01 Did you try Atinux's suggestion above? I upgraded to node 8.6 and it's working fine for me now.
@qm3ster
I tried rm -rf node_modules && npm install I even tried making a new project but it is still not working
@vivensio he says he's on 8.9.4 though :confused:
What OS?
Yo! It's really no rush. Just not using the latest version of nuxtjs
. Version 1.3
works just good.
Running Ubuntu 16.04.3 LTS
. With nodejs version 9.7.2
also a no-go.
I'm on ubuntu 16.04
node 9.7.1
npm 5.7.1
nuxt 1.4.0 or 1.3.0 even 1.0.0 they are all not working
its ok now it works it was because I used nvm to update the node version which wasn't installed to the sudo environment I mean it was only available for bash or regular users so the node version for sudo stayed at it was 7.blablala and I had to use sudo npm run dev to run the project
Please don't ever run node in sudo
This was a PSA.
@template01 you should always update everything all day every day. It's the only way to live!
Can you do console.log(process.version) at the top of your nuxt.config.js?
@qm3ster Haha! Appreciate your fomo! So the script crashes before it outputs any info from console.log(process.version)
. On the working version of nuxtjs (1.3
) i get an output of v8.2.1
.
@template01 can you try v8.6.0
or higher? I'd go bump the engines
property but in the next release this line with destructuring will actually be gone.
I checked CI, and it's all done on the latest version of 8.x.x, not earlier 8.x.x
Also ran into this issue after upgrading nuxt when running on Windows node v8.1.2. I upgraded to the latest stable node v8.10 but then ran into a can't find NodeTemplatePlugin
error. So I deleted node_modules
and package-lock.json and reinstalled from scratch but then ran into:
error in ./node_modules/vuetify/dist/vuetify.css
Module build failed: ValidationError: PostCSS Loader Invalid Options
options['useConfigFile'] is an invalid additional property
@ ./node_modules/vuetify/dist/vuetify.css 4:14-120 13:3-17:5 14:22-128
@ ./src/plugins/vuetify.js
@ multi vue vue-router vue-meta vuex vue-style-loader/lib/addStylesClient css-loader/lib/css-base ~/plugins/vuetify.js
I don't have postcss installed or configured separately or have any postcss plugins, I'm just using a vanilla Nuxt + Vuetify template. I tried downgrading [email protected] but that didn't work, neither did removing global dependent packages like Webpack. In the end I had to revert to my original npm-shrinkwrap.json
. Then I can update every dependency except for nuxt which always fails with the above error.
My working deps (fails when upgrading to nuxt v1.4.0):
"dependencies": {
"@servicestack/client": "^1.0.8",
"@servicestack/images": "^1.0.0",
"nuxt": "^1.3.0",
"vuetify": "^1.0.8"
},
"devDependencies": {
"@nuxtjs/proxy": "^1.1.4",
"@servicestack/cli": "^1.0.2",
"babel-eslint": "^8.2.2",
"eslint": "^4.19.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^2.0.0",
"eslint-plugin-vue": "^4.3.0",
"gulp": "^3.9.1",
"typescript": "^2.7.2"
}
IMO this breaking change was unnecessary, v8.1.2 was a fairly recent version and to break everyone and force them to upgrade their working node versions causes undue friction, now we're blocked from being able to upgrade Nuxt.
@mythz I've the same problem of you...
Just discovered the solution was to delete my old npm-shrinkwrap.json
and node_modules
then re-install so it must be due to one of the previously pinned deps.
Here is what I found prior Nodejs 8.3.x the ES6 Spread Attributes is not supported and will throw this error
at first, was confusing as I try installing the latest Nodejs 9.10.0 but this didn't help.
It turns out I'm using old electron that operates with node v8.2.0 so I updated to [email protected]. and I can confirm this fixed the issue electron beta 6 is using Nodejs v8.9.3
As @qm3ster suggested add this to your main.js or script and confirm that you use Nodejs >= 8.3.x
console.log(process.version)
I had the same issue as @yovchev and am running electron
1.8.6 with node
8.5.0 installed via nvm
. I was confused until I saw his comment and checked the version of node bundled with electron.
Summarised from the change log on the electron release page:
| electron | node.js |
|:---:|:---:|
| 2.0.0-beta1+ | 8.9.3 |
|1.8.1+| 8.2.1|
|1.8.0 | (pulled due to security issue)|
|1.7.x| 7.9.0 |
Node 10.x is out at the time of writing.
same bug, project not started on the latest node
The latest build of nuxt-edge supports Node 6.x again by automatically falling back to the legacy build.
PS: Don't forget to add babel-polyfill
dependency to your project if you need legacy build.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
I had this same issue when using Node
8.0.0
. This was resolved when upgrading to Node LTS8.9.4
.See issue https://github.com/nuxt-community/create-nuxt-app/issues/39