按照 https://github.com/yeoman/generator-ember 教程将EmberJS与Yeomane一起使用,在运行grunt server
后,浏览器为空白。
我希望看到此页面,但没有显示:![在此处输入图像说明] [1]
的更新: 的
控制台错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/styles/style.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/jquery/jquery.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/handlebars/handlebars.runtime.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/ember/ember.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/ember-data-shim/ember-data.js
Uncaught ReferenceError: Ember is not defined compiled-templates.js:1
Uncaught ReferenceError: Ember is not defined combined-scripts.js:3
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/affix.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/alert.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/dropdown.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/tooltip.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/modal.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/transition.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/button.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/popover.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/carousel.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/scrollspy.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/collapse.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/bower_components/bootstrap-sass/js/tab.js
更新2:
works-Mac:myemberapp1 work$ grunt server
Running "server" task
Running "clean:server" (clean) task
Running "replace:app" (replace) task
Replace app/index.html -> .tmp/index.html
Running "concurrent:server" (concurrent) task
Running "emberTemplates:dist" (emberTemplates) task
File ".tmp/scripts/compiled-templates.js" created.
Done, without errors.
Running "compass:server" (compass) task
Done, without errors.
Running "neuter:app" (neuter) task
Running "connect:livereload" (connect) task
Started connect web server on localhost:9000.
Running "open:server" (open) task
Running "watch" task
Waiting...
答案 0 :(得分:4)
对于特定错误Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/styles/style.css
,您还应检查是否已安装compass
服务器。那就是:
gem install compass
要检查罗盘是否正常运行,请运行grunt serve --verbose
并检查输出是否有任何错误,例如:
in `to_specs': Could not find compass (>= 0) amongst [...] (Gem::LoadError)
答案 1 :(得分:3)
脚手架完成后,您必须运行命令bower install
和npm install
来安装所需的软件包(在bower.json
和package.json
文件中描述。之后, grunt将能够提供依赖项。
在构建项目并使用引入新依赖项时,您将通过编辑bower.json
和/或package.json
文件并重新运行安装来添加它们。下载的包通常不存储在源代码管理中。