简体   繁体   English

MEAN堆栈和bootstrap / bower问题

[英]MEAN stack and bootstrap / bower issue

I'm currently exploring new ways to develop and have come across the MEAN stack, which can be found here - http://mean.io/#!/ 我正在探索新的开发方式,并且遇到了MEAN堆栈,可以在这里找到 - http://mean.io/#!/

I have installed Mongo, Node (plus npm etc...) and gone through all the steps stated on the website. 我已经安装了Mongo,Node(加上npm等...)并完成了网站上规定的所有步骤。 The issue comes when I execute grunt (or even node server.js) and open the webpage - terminal displays the following: 当我执行grunt(甚至是node server.js)并打开网页时,问题出现了 - 终端显示以下内容:

Error: ENOENT, open '/Users/xxx/myApp/bower_components/bootstrap/dist/css/bootstrap.css' 错误:ENOENT,打开'/Users/xxx/myApp/bower_components/bootstrap/dist/css/bootstrap.css'

First problem is, bower_components directory doesn't actually exist! 第一个问题是,bower_components目录实际上并不存在! I'm assuming this is probably the first point of call, however I'm not totally sure where to start in troubleshooting this (I'm new to bower). 我假设这可能是第一个调用点,但是我不能完全确定从哪里开始进行故障排除(我是凉爽的新手)。

Does anyone have any experience with MEAN stack and/or how to resolve the issue with bootstrap / bower_components directory? 有没有人有MEAN堆栈的经验和/或如何解决bootstrap / bower_components目录的问题?

Any help would be appreciated. 任何帮助,将不胜感激。

Thanks in advance :) 提前致谢 :)

It sounds like you haven't installed bower, and as a result of that not installed bootstrap through bower. 听起来你没有安装凉亭,并且由于没有通过凉亭安装引导程序。

Install Bower 安装Bower

$ npm install -g bower

Install bootstrap via bower 通过凉亭安装bootstrap

$ bower install bootstrap

You can read more about it their website . 您可以在网站上阅读更多相关信息。 And also search for bower packages here . 在这里搜索凉亭包。 Since you're using angular you might wanna download angular-bootstrap as well. 既然你正在使用角度,你可能也想下载angular-bootstrap。

UPDATE UPDATE

What bower provides is a package manager for client-side modules. bower提供的是客户端模块的包管理器。 Similar to npm, with the difference that npm also provides backend-/nodejs-modules. 与npm类似,区别在于npm还提供backend- / nodejs-modules。

If you're using mean.io your project will be prepared with a file called bower.json and another one called package.json which specifies the dependencies in your project. 如果您正在使用mean.io您的项目将使用名为bower.json的文件和另一个名为package.json的文件来准备,该文件指定项目中的依赖项。 To install these, start off by getting your node.js dependencies: 要安装它们,首先要获取node.js依赖项:

$ npm install

If you want bower to be installed globally, use: 如果您想要全局安装bower,请使用:

$ npm install -g bower

Then install your bower dependencies 然后安装您的bower依赖项

$ bower install

And now you should be good to go. 现在你应该好好去。

You can also add bower manually 您也可以手动添加凉亭

or if you want to create your mean project from scratch 或者如果你想create your mean project from scratch

Install Bower 安装Bower

$ npm install -g bower

Install bootstrap via bower 通过凉亭安装bootstrap

$ bower install bootstrap

Save your dependencies 保存您的依赖项

If you want to create bower.json to save your dependencies: 如果要创建bower.json以保存依赖项:

$ bower init 

and follow the instructions provided in the console. 并按照控制台中提供的说明进行操作。

Now when you install new bower packages you use --save and bower will add the dependency to your bower.json. 现在,当您安装新的bower软件包时,使用--save和bower会将依赖项添加到您的bower.json中。

$ bower install bootstrap --save

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM