admin管理员组

文章数量:1384189

/bower_ponents doesn’t work.

I get 404 error:

GET /bower_ponents/jquery/jquery.js 404

My configuration is as described in Bower documentation and here:

app.use(express.static(path.join(__dirname, 'public')));
app.use('/bower_ponents',  express.static(__dirname + '/bower_ponents'));

In my .html file I have:

<script src="/bower_ponents/jquery/jquery.js"></script>

But there is no /bower_ponents/jquery/jquery.js. There is \bower_ponents\jquery\dist\jquery.js. Did they change the configuration of Bower packages but forgot to change docs?

/bower_ponents doesn’t work.

I get 404 error:

GET /bower_ponents/jquery/jquery.js 404

My configuration is as described in Bower documentation and here:

app.use(express.static(path.join(__dirname, 'public')));
app.use('/bower_ponents',  express.static(__dirname + '/bower_ponents'));

In my .html file I have:

<script src="/bower_ponents/jquery/jquery.js"></script>

But there is no /bower_ponents/jquery/jquery.js. There is \bower_ponents\jquery\dist\jquery.js. Did they change the configuration of Bower packages but forgot to change docs?

Share Improve this question edited May 23, 2017 at 11:52 CommunityBot 11 silver badge asked May 29, 2014 at 12:43 GreenGreen 30.9k62 gold badges163 silver badges253 bronze badges 2
  • If you look in the file system, do you see the file /bower_ponents/jquery/jquery.js? – dylants Commented May 29, 2014 at 14:25
  • @dylants: No, there is no such a path in the file system. jquery.js is located here: \public\bower_ponents\jquery\dist\jquery.js. I know I can move jquery.js and it will work but it seems that it is not correct, isn't it? – Green Commented May 29, 2014 at 15:54
Add a ment  | 

2 Answers 2

Reset to default 3

You should change your script tag to point to the (new) location of jQuery:

<script src="/bower_ponents/jquery/dist/jquery.js"></script>

It looks like jQuery has separated the "source" code from the "distribution" code, by providing two directories in their bower ponent. It is not remended that you move things around inside bower_ponents since that directory is generated from the bower install.

I had the same issue. In my case, i had accidentally deleted the .bowerrc, causing the bower_ponents to be saved in the wrong place

本文标签: javascriptbowercomponents doesn’t load dependencies on the pageStack Overflow