Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Flex's avatar
Level 4

https://stackoverflow.com/questions/74859398/how-to-fix-error-in-installing-vue-in-laravel-project

going to install vue as using following commnd npm init vite vue in a laravel project. but when I try it got following error message in my terminal

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)
npm ERR! code 1
npm ERR! path F:22\Laravel + Vue\laravel-vue-survey
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-vite "vue"

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Nalaka\AppData\Local\npm-cache\_logs22-12-20T06_31_44_838Z-debug-0.log
PS F:22\Laravel + Vue\laravel-vue-survey> SyntaxError: Unexpected token '.'

0 likes
4 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Old npm/node version perhaps? What version of node ?

MaverickChan's avatar

first you need to update your node version. second , not recommand run npm init vite vue inside an existing laravel project if your front end is separated from the backend , then install it in another directory. if your want to use vite as frontend fro laravel , follow the offical tutorial. You may have to edit the package.json file.

Please or to participate in this conversation.