OS: MS Windows 10 Pro 64-bits
OS build: 10.0.17763
From scratch:
compile the application and start the dev server
app-nuxtnode_modules\@nuxt\utils\dist\utils.js:1752 const match = asString.match(/^([^{(]+)=>\s(.)/s);
SyntaxError: Invalid regular expression flags
at createScript (vm.js:80:10) at Object.runInThisContext (vm.js:139:10) at Module._compile (module.js:607:28) at Object.Module._extensions..js (module.js:654:10) at Module.load (module.js:556:32) at tryModuleLoad (module.js:499:12) at Function.Module._load (module.js:491:3) at Module.require (module.js:587:17) at require (internal/module.js:11:18) at Object. (D:\projectscompany_project\app-nuxtnode_modules\@nuxtcli\distcli-chunk.js:15:15) 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.
By tracking down the bug locally in node_modules\@nuxt\utils\dist\utils.js
on line 1752: const match = asString.match(/^([^{(]+)=>\s(.)/s);
line 1754: const fullFunctionBody = match[2].match(/^{?(\sreturn\s+)?(.?)}?$/s);
and line 1756: if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/s))
and removing the s flag from these three lines, npm run dev worked prefect.
This issue as been imported as question since it does not respect nuxt.js issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/nuxt.js/issues/c9153.
What Node.js version do you use?
I ran into the same issue with both the _nuxt_ and _nuxt generate_ commands.
OS: MS Windows 10 Pro 64-bits
Node version: 8.16
Upgrading to Node 10.15 fixed it for me.
Should probably add
"engines": {
"node": ">=10.0.0"
}
to your package.json
Fixed in #5608 , fix will be included in next release
Had same issue, upgrading node.js fixed it.
I have:
nuxtjs v2.10.2npm v6.12.0node v10.15.3npm run generate I get SyntaxError: invalid regexp group.npm run dev works fine in my case!
Most helpful comment
I ran into the same issue with both the _nuxt_ and _nuxt generate_ commands.
OS: MS Windows 10 Pro 64-bits
Node version: 8.16
Upgrading to Node 10.15 fixed it for me.