0

I installed jQuery and Bootstrap with Bower.

I got this error

syntaxerror: expected expression, got '<' <!doctype html> jquery

My code

<script src="../bower_components/jquery/dist/jquery.min.js"></script>
<script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

There is my folder structure

http://laravel.io/bin/d9MnD

I also tried to put the code in head, but did not work

Here is my server data

var express = require('express'),
        app = express();

app
    .use(express.static('./public'))
    .get('*', function (req, res) {
        res.sendfile('public/main.html');
    })
    .listen(3000);
4
  • for starters the order is wrong. Also seems like path to jQuery is wrong and server is returning html Commented May 27, 2016 at 23:54
  • seems to be fine though, have you tried by including jquery first then, bootstrap? Commented May 28, 2016 at 0:04
  • Can you please explain more? @charlietfl Commented May 28, 2016 at 0:09
  • I fixed it. It is 2 a.m. now. Still getting the same error @narainsagar Commented May 28, 2016 at 0:13

1 Answer 1

1

I use this on server.js:

app.use('/bower_components',  express.static(__dirname + '/bower_components'));  

now in anything place I can use this and work fine, example:

<script type="text/javascript" src="/bower_components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

with this you call directly to the folder

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.