andrepaulo andrepaulo - 9 months ago 35
Javascript Question

lite-server not providing .js file inside /js folder - browser doesnt request /js file

I'm running a

lite-server
with
npm run lite


My jQuery file is being loaded normally, and my css inside the css folder too, but the browser do not even make the GET request for the
main.js
file.

the
main.js
file is inside the /js folder as
style.css
as in /css folder

Am I missing something?

this is my 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>


EDIT: -> Just realized also that the browser isn't making the GET request for this file. And also if i make a request directly to the js file, the server returns it.

index.html request
main.js request

And the
npm run lite
running:

$ 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

Answer Source

You have missstyped the src by scr

error

correct

<script type="text/javascript" src="js/main.js"></script>