简体   繁体   English

Laravel Vue.js 组件在服务器上不起作用

[英]Laravel Vue.js components are not working on server

I am new to Laravel Vue and I recently came to a project.我是 Laravel Vue 的新手,我最近来到一个项目。 at my localhost everything working fine, but when I pushed my project to the server via git, the Vue components not working.在我的本地主机上一切正常,但是当我通过 git 将项目推送到服务器时,Vue 组件无法正常工作。 it says this error in the console...它在控制台中显示此错误...

Uncaught SyntaxError: Unexpected token '<' app.js:1未捕获的语法错误:意外的令牌 '<' app.js:1

there is no npm install on the server so I run the command locally "npm run production" and pushed the app.js and all other js files via git to the server.. the server files are the same as localhost but Vue components not working on the server, but they are running on localhost..., I am stuck to the problem with 3 days, any help will be highly appreciated.服务器上没有安装 npm 所以我在本地运行命令“npm run production”并通过 git 将 app.js 和所有其他 js 文件推送到服务器。服务器文件与 localhost 相同,但 Vue 组件不起作用在服务器上,但它们在 localhost 上运行......,我在 3 天内遇到了这个问题,任何帮助将不胜感激。

Thanks谢谢

Just for clarity, the CSS file is rendering but the JS file not为清楚起见,CSS 文件正在渲染,但 JS 文件没有

In my console:在我的控制台中:

Resource interpreted as Stylesheet but transferred with MIME type text/html : /rider/auth/public/css/app.css .资源解释为样式表,但使用 MIME 类型text/html传输: /rider/auth/public/css/app.css

Uncaught SyntaxError: Unexpected token '<' app.js:1未捕获的语法错误:意外的令牌 '<' app.js:1

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

So the issue was in the.env file, and there was a variable "ASSET_URL =./public", this was not allowing the application to go to the correct path.所以问题出在 .env 文件中,并且有一个变量“ASSET_URL =./public”,这不允许将 go 应用到正确的路径。 Thanks @Aless55 for your great support感谢@Aless55 的大力支持

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

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