简体   繁体   English

咕unt声不包括javascript文件

[英]Grunt not including javascript file

This is an angular app. 这是一个有角度的应用程序。 I have a bower.json with a lot of libraries put like this: 我有一个Bower.json,其中包含很多这样的库:

"dependencies": {
    "angular": "^1.4.0",
    "bootstrap": "^3.2.0",
    ... 
    "angular-socket-io": "^0.7.0",
    "socket.io-client": "^1.7.2"

I run 我跑

bower install

and I can see that in the "bower_components"-folder there are folders and files for both "angular-socket-io" and "socket.io-client". 我可以看到在“ bower_components”文件夹中,有“ angular-socket-io”和“ socket.io-client”的文件夹和文件。

When I then run this command: 当我运行以下命令时:

grunt serve

I can see that this one is included: 我可以看到其中包括:

<script src="bower_components/angular-socket-io/socket.js"></script>

However, I cannot find any trace of "socket.io-client". 但是,我找不到“ socket.io-client”的任何痕迹。 Why? 为什么? Am I supposed to include this manually? 我应该手动添加吗? I wonder why then. 我不知道为什么。 All the other bower cmopoenents are beeing added autmatically of "grunt serve". 所有其他凉亭cmopoenents是蜜蜂自动添加的“咕serve作响”。

PS: This causes the error "io is not defined" when I try to instantiate a socket frmo a factory. PS:当我尝试从工厂实例化套接字时,这会导致错误“未定义io”。

I guess it was an issue with versions. 我想这是版本的问题。 Im running angular 1.4. 我的跑步角度为1.4。 Having this line: 有这行:

"socket.io-client": "^0.7.10", “ socket.io-client”:“ ^ 0.7.10”,

seems made the trick. 似乎是把戏。 Before I used latest version of socket.io-client (1.7). 在使用最新版本的socket.io-client(1.7)之前。 And I got incompatibility error. 而且出现不兼容错误。 But now the socket-client is being loaded. 但是现在套接字客户端正在加载。

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

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