2
我正在向Heroku部署一個Angular應用程序,並且需要添加Angular組件和其他一些功能。部署正在進行,除部署的站點以外的所有內容都缺少bower_components文件夾。我已經經歷了一切,並閱讀了許多StackOverflow帖子,但我一定錯過了一些東西。這裏是我的代碼:Heroku - 沒有bower_components文件夾
的package.json
{
"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);
Procfile
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
[email protected] /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/bower
[email protected] /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
[email protected] /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/bower
[email protected] /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9/node_modules/express
????????? [email protected]
npm WARN [email protected] No description
-----> Found bower.json, running bower install
-----> Installing dependencies
> [email protected] postinstall /tmp/build_9a163093ad395af381c984026f6a5742/me-my-webapp-bfae0f9
> ./node_modules/bower/bin/bower install
npm WARN [email protected] No description
對我來說,它看起來好像一切正常,但是當我加載頁面,我得到斷開鏈接到bower_components的負載文件夾是這樣的:
不能得到/bower_components/materialize/dist/css/materialize.css
沒有亭子文件夾。爲什麼!?