我正在使用lite-server
npm run lite
我的jQuery文件正常加载,我的css也在css文件夹中,但是浏览器甚至没有发出main.js
文件的GET请求。
main.js
文件在/ js文件夹中作为style.css
在/ css文件夹中
我错过了什么吗?
这是我的HTML
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript" scr="js/main.js"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
test
</body>
</html>
编辑: - &gt;刚刚意识到浏览器没有对此文件发出GET请求。如果我直接向js文件发出请求,服务器也会返回它。
npm run lite
正在运行:
$ npm run lite
> sdfa@1.0.0 lite C:\temp\nodeIntro
> lite-server
Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
** browser-sync config **
{ injectChanges: false,
files: [ './**/*.{html,htm,css,js}' ],
watchOptions: { ignored: 'node_modules' },
server: { baseDir: './', middleware: [ [Function], [Function] ] } }
[BS] Access URLs:
------------------------------------
Local: http://localhost:3000
External: http://192.168.1.4:3000
------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.4:3001
------------------------------------
[BS] Serving files from: ./
[BS] Watching files...
17.03.11 12:52:27 304 GET /index.html
17.03.11 12:52:27 304 GET /node_modules/jquery/dist/jquery.min.js
17.03.11 12:52:27 304 GET /node_modules/jquery/dist/jquery.js
17.03.11 12:52:27 304 GET /css/style.css
答案 0 :(得分:1)
您错误地输入了 src scr
错误
正确
<script type="text/javascript" src="js/main.js"></script>