Angularjs Heroku-无bower_组件文件夹
我正在向Heroku部署一个Angular应用程序,我需要bower添加Angular组件和其他一些组件。部署正在工作,除了部署的站点之外,其他所有内容都缺少bower_components文件夹。我已经看完了所有的东西,读了很多StackOverflow的帖子,但我肯定错过了什么。这是我的密码: package.jsonAngularjs Heroku-无bower_组件文件夹,angularjs,heroku,deployment,bower,Angularjs,Heroku,Deployment,Bower,我正在向Heroku部署一个Angular应用程序,我需要bower添加Angular组件和其他一些组件。部署正在工作,除了部署的站点之外,其他所有内容都缺少bower_components文件夹。我已经看完了所有的东西,读了很多StackOverflow的帖子,但我肯定错过了什么。这是我的密码: package.json { "name": "my-webapp", "version": "1.0.0", "main": "app.js", "dependencies":
{
"name": "my-webapp",
"version": "1.0.0",
"main": "app.js",
"dependencies": {
"bower": "^1.8.0",
"express": "^4.15.2"
},
"devDependencies": {},
"scripts": {
"start": "node web.js",
"postinstall": "./node_modules/bower/bin/bower install"
},
"repository": {
"type": "git",
"url": "git+https://github.com...."
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com..."
},
"homepage": "https://github.com...",
"description": ""
}
web.js
var express = require('express'),
app = express();
app.use(express.static(__dirname));
app.get('/', function(req, res) {
res.sendfile('index.html', {root: __dirname })
});
var server = app.listen(process.env.PORT || 80);
程序文件
web: node web.js
bower.json
{
"name": "my-webapp",
"description": "",
"main": "app.js",
"authors": [
"Me"
],
"license": "ISC",
"homepage": "https://my-webapp.herokuapp.com/",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular-material-icons": "^0.7.1",
"angular-material": "^1.1.1",
"materialize": "^0.97.8",
"ng-lodash": "^0.5.0"
}
以下是生成输出,已编辑的突出显示:
-----> Building dependencies
Prebuild detected (node_modules already exists)
Rebuilding any native modules
bower@1.8.0 /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/bower
express@4.15.2 /tmp/build_9a163093ad395af381c984026f6a5742/mugwag-my-webapp-bfae0f9/node_modules/express
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components
-----> Build succeeded!
-----> Rebuilding any native dependencies
bower@1.8.0 /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/bower
express@4.15.2 /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/express
????????? bower@1.8.0
npm WARN my-webapp@1.0.0 No description
-----> Found bower.json, running bower install
-----> Installing dependencies
> my-webapp@1.0.0 postinstall /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9
> ./node_modules/bower/bin/bower install
npm WARN my-webapp@1.0.0 No description
对我来说,似乎一切都正常,但当我加载页面时,我会收到大量指向bower_components文件夹的断开链接,如下所示:
无法获取/bower\u components/materialize/dist/css/materialize.css
没有bower文件夹。为什么 仅供参考-我从未解决过这个问题,但现在使用Amazon S3来托管Angular应用程序。因为Angular完全是客户端的,所以不需要服务器。只需将代码上传到S3或类似的普通主机上并直接引用即可 我希望这能帮助别人