2015-04-22 2 views
0

Я пытаюсь развернуть мое angularJs приложения Heroku после этого урока: http://www.sitepoint.com/deploying-yeomanangular-app-heroku/развертывания угловатого Heroku

Я был в состоянии получить мое приложение загружается в Heroku, но unforunatly не кажется, чтобы загрузить любого из мои сценарии.

https://data-display-prototype.herokuapp.com/ 

При проверке страницы я получаю кучу ошибок 404:

Failed to load resource: the server responded with a status of 404 (Not Found) 

Запуск приложения локально работает отлично. К сожалению, я не знаю, где искать решение.

обновление:

все эти ошибки со страницы (которые я думаю, это все скрипты из index.html)

Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/angular-chart.js/dist/angular-chart.css 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/jquery/dist/jquery.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/Chart.js/Chart.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/app.js  
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/controllers/main.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/controllers/firebase-test.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/controllers/chart-test.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/firebase/firebase.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/services/data-services.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/scripts/controllers/sidebar.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/angularfire/dist/angularfire.min.js 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/angular-chart.js/dist/angular-chart.js 
Failed to load resource: the server responded with a status of 404 (Not Found) angular.min.js:36 
Uncaught Error: [$injector:modulerr]    http://errors.angularjs.org/1.4.0-beta.2/$injector/modulerr?p0=DataDisplayP…s.com%2Fajax%2Flibs%2Fangularjs%2F1.4.0-beta.2%2Fangular.min.js%3A17%3A350) 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/bower_components/angular-chart.js/dist/angular-chart.css 
Failed to load resource: the server responded with a status of 404 (Not Found) https://data-display-prototype.herokuapp.com/styles/main.css  
Failed to load resource: the server responded with a status of 404 (Not Found) 

обновление 2:

package.json file:

{ 
    "name": "datadisplayprototype", 
    "version": "0.0.0", 
    "dependencies": { 
    "express": "~4.12.3", 
    "gzippo": "~0.2.0", 
    "morgan": "~1.5.2" 
    }, 
    "repository": {}, 
    "devDependencies": { 
    "grunt": "^0.4.5", 
    "grunt-autoprefixer": "^2.0.0", 
    "grunt-concurrent": "^1.0.0", 
    "grunt-contrib-clean": "^0.6.0", 
    "grunt-contrib-compass": "^1.0.0", 
    "grunt-contrib-concat": "~0.5.1", 
    "grunt-contrib-connect": "^0.9.0", 
    "grunt-contrib-copy": "^0.7.0", 
    "grunt-contrib-cssmin": "^0.12.0", 
    "grunt-contrib-htmlmin": "^0.4.0", 
    "grunt-contrib-imagemin": "^0.9.2", 
    "grunt-contrib-jshint": "^0.11.0", 
    "grunt-contrib-uglify": "^0.7.0", 
    "grunt-contrib-watch": "^0.6.1", 
    "grunt-filerev": "^2.1.2", 
    "grunt-google-cdn": "^0.4.3", 
    "grunt-newer": "^1.1.0", 
    "grunt-ng-annotate": "^0.9.2", 
    "grunt-svgmin": "^2.0.0", 
    "grunt-usemin": "^3.0.0", 
    "grunt-wiredep": "^2.0.0", 
    "jshint-stylish": "^1.0.0", 
    "load-grunt-tasks": "^3.1.0", 
    "time-grunt": "^1.0.0", 
    "grunt-karma": "~0.10.1", 
    "karma-phantomjs-launcher": "~0.1.4", 
    "jasmine-core": "~2.2.0", 
    "karma": "~0.12.31", 
    "karma-jasmine": "~0.3.5" 
    }, 
    "engines": { 
    "node": ">=0.10.0" 
    }, 
    "scripts": { 
    "test": "grunt test" 
    } 
} 

обновление 3: решена!

Проблема оказалась в том, что я удалил комментарии в моем файле index.html, который использует grunt для генерации файлов сценариев. Как noob я не подозревал, что комментарии могут действительно иметь функцию и просто удалить их, не задумываясь. Очевидно, что Heroku знает, как развернуть приложение из папки dist. Поскольку папка dist была создана без каких-либо скриптов, я получил ошибки.

+0

у вашего проекта есть package.json? Вы используете беседку для загрузки материала? – tpie

+0

у него есть package.json, и я так думаю. В приложении есть bower_components, если это то, что вы имеете в виду, и скрипты для бесед. Однако на странице также не может загружаться скрипты, не поддерживающие bower. – Mischa

+0

что вы получаете 404? добавьте его в OP ... не все, я думаю, но некоторые. Кажется ли это материал, который в основном установлен беседкой? – tpie

ответ

0

Добавление этого в нижнюю часть вашего пакета package.json должно исправить вашу проблему с бавелем: Если вы проверите свой журнал установки, вы увидите, что он, вероятно, даже не работает. Я не верю, что герой проверяет .bowerrc.

"scripts": { 
    "postinstall": "bower install" 
    } 

postinstall сообщает npm запускать дополнительные скрипты или команды. Потому что heroku будет запускать npm install, когда он найдет package.json, но не установит bower install, это позволит нам получить беседу, когда будет сделано npm.

У вас есть еще один вопрос здесь, я считаю:

app.use(gzippo.staticGzip("" + __dirname + "/dist"));

Это настройки вашего сайта для ссылки на каталог /dist, который не там, где ваше приложение. Или, если вы действительно хотите, чтобы он указывал на каталог /dist, попробуйте добавить ../app/ ко всем ссылкам на скрипт в вашем html-файле.

+0

спасибо за помощь, мне удалось решить проблему. – Mischa

+0

в чем проблема – tpie

Смежные вопросы