Html 无法使用Vue.js CLI从bower_组件加载资源
在我的项目中,我在尝试引用CSS和JS文件时收到以下错误Html 无法使用Vue.js CLI从bower_组件加载资源,html,css,vue.js,bower,Html,Css,Vue.js,Bower,在我的项目中,我在尝试引用CSS和JS文件时收到以下错误 Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:8080/bower_components/bootstrap/dist/css/bootstrap.min.css 这是我的文件结构 app |bower_components |bootstrap
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost:8080/bower_components/bootstrap/dist/css/bootstrap.min.css
这是我的文件结构
app
|bower_components
|bootstrap
|dist
|css
| bootstrap.min.css
|jquery
|dist
|jquery.min.js
|build
|config
|node_modules
|src
|static
|index.html //The file I am receiving error on
public //using Slim framework with PHP to generate RESTful API
src
vendor
在我的index.html
文件中,我使用以下代码尝试引用bootstrap.min.css文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Template</title>
<link rel="stylesheet" href="./bower_components/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
模板
我使用的是Visual Studio代码,这使我能够按住CTRL键并单击指向bootstrap.min.css文件的链接,然后加载ok,所以我不确定我在这里哪里出错了
我正在使用
vue.js CLI
作为app
文件夹,并使用Slim Framework
和PHP
在public/src/vendor
文件夹中生成RESTful API,如果有帮助的话?任何帮助都将不胜感激。我能够解决此问题,它与使用Vue.js CLI相链接
我需要将bower_components文件夹添加到静态文件夹中,然后引用该文件,就像
<link rel="stylesheet" href="./static/bower_components/bootstrap/dist/css/bootstrap.min.css">
您尝试过从链接中删除“/”吗?@Aaron是的,仍然收到相同的错误。我已经尝试过使用vue.js CLI,而且效果很好,所以它肯定与此有关,只是不确定如何。。。