简体   繁体   English

错误:将 vue.js 安装到 Laravel 项目时找不到模块 'C:\vite\bin\vite.js'

[英]Error: Cannot find module 'C:\vite\bin\vite.js' when installing vue.js to Laravel project

I wanted to learn Laravel and Vue.js so I tried installing both by following this tutorial: https://youtu.be/WLQDpY7lOLg?t=1058我想学习 Laravel 和 Vue.js,所以我尝试按照本教程安装两者: https ://youtu.be/WLQDpY7lOLg?t=1058

Everything worked as it should until the npm run dev command...一切正常,直到 npm run dev 命令...

These are the commands I ran in the Laravel project terminal(in the tutorial at 21:19)这些是我在 Laravel 项目终端中运行的命令(在 21:19 的教程中)

npm init vite vue
cd vue/
npm install
npm run dev

This is the output that I get after running the last command这是我运行最后一个命令后得到的输出

PS C:\Laravel&React Projects\laravel-vue-survey\vue> npm run dev

> vue@0.0.0 dev
> vite

'React' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:949
  throw err;
  ^

Error: Cannot find module 'C:\vite\bin\vite.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:946:15)
        at Module._load (node:internal/modules/cjs/loader:787:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.4.0

I'm trying to solve this issue for some hours now but still no luck... I hope someone knows how to make it work...我正在尝试解决这个问题几个小时,但仍然没有运气......我希望有人知道如何让它工作......

I don't understand the question but laravel comes already integrated with Vuejs3.我不明白这个问题,但 laravel 已经与 Vuejs3 集成。 You can fin these files on resources-->js-->pages ie Maybe if you can be more precise in the question could help.您可以在资源-->js-->pages 上找到这些文件,即如果您可以更准确地解决问题,也许会有所帮助。

ugh...So i fixed the problem... If any1 else runs in something like that...First make sure you don't name your projects using characters such as (&,%,$,?...).呃...所以我解决了这个问题...如果任何其他运行在类似的东西...首先确保您没有使用诸如 (&,%,$,?...) 之类的字符来命名您的项目。 Parent folder of this project had '&' in its name and that caused the error...此项目的父文件夹的名称中有“&”,这导致了错误...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM