bower,grunt-usemin,grunt-contrib-uglify,angular-fullstack,ng-flow , Uglify can't parse “flow.js”


Uglify can't parse “flow.js”

Question:

Tag: bower,grunt-usemin,grunt-contrib-uglify,angular-fullstack,ng-flow

I'm having an annoying issue where uglify (called through grunt-usemin) cannot parse the url for a package named flow.js. This package is installed as a dependency of ng-flow.

The url looks like this:

bower_components/flow.js/dist/flow.js

When I run grunt build, I get the following error:

Warning: Unable to read "dist/public/bower_components/flow.js" file (Error code: EISDIR). Use --force to continue.

Since I don't know much about usemin and uglify, I can't put my finger on the issue. My guess was that it breaks when it gets at the first "flow.js" of the url. So, I tried to install flow.js as flowjs in my bower.json, but since its a dependency of ng-flow it will still get flow.js when running bower update.

Can anyone tell me more about this error, or suggest me a workaround to rename the dependency package?

Edit: usemin part of the Gruntfile

useminPrepare: {
  html: ['<%= yeoman.client %>/index.html'],
  options: {
    dest: '<%= yeoman.dist %>/public'
  }
},
usemin: {
  html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
  js: ['<%= yeoman.dist %>/public/**/*.js'],
  options: {
    assetsDirs: [
      '<%= yeoman.dist %>/public',
      '<%= yeoman.dist %>/public/assets/images'
    ],
    // This is so we update image references in our ng-templates
    patterns: {
      js: [
        [/(assets\/images\/.*?\.(?:gif|jpeg|jpg|png|webp|svg))/gm, 'Update the JS to reference our revved images']
      ]
    }
  }
}
grunt.registerTask('build', [
'clean:dist',
'injector:less', 
'concurrent:dist',
'injector',
'wiredep',
'useminPrepare',
'autoprefixer',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'cdnify',
'cssmin',
'uglify',
'rev',
'usemin']);

For the records, the grunt file is generated using https://github.com/DaftMonk/generator-angular-fullstack


Answer:

The problem is that Grunt can't distinguish between a directory ending in '.js' and a .js file.

The workaround will be to use a wildcard expression to grab the files in flow.js and to exclude the directory itself.

Edit: You will need to exclude flow.js from both usemin AND rev.

usemin: {
  html: ['<%= yeoman.dist %>/public/{,*/}*.html'],
  css: ['<%= yeoman.dist %>/public/{,*/}*.css'],
  js: {
    src: ['<%= yeoman.dist %>/public/{,*/}*.js', '!<%= yeoman.dist %>/public/bower_components/flow.js'],
  },
  ...

rev: {
  dist: {
    files: {
      src: [
        '<%= yeoman.dist %>/public/{,*/}*.js',
        '<%= yeoman.dist %>/public/{,*/}*.css',
        '<%= yeoman.dist %>/public/assets/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
        '<%= yeoman.dist %>/public/assets/fonts/*',
        '!<%= yeoman.dist %>/public/bower_components/flow.js'
      ]
    }
  }
},

Related:


Remove warning for package “was not injected in your file” when using Grunt?


angularjs,gruntjs,bower
I have "angular-i18n" installed as a bower dependency. When I run grunt serve or grunt build I have receive warning: angular-i18n was not injected in your file. Please go take a look in "/$APP_ROOT/bower_components/angular-i18n" for the file you need, then manually include it in your file. How can I remove...

How to load the project into Github


node.js,github,bower
I need to load my project into Github. So I use GitHub for windows to do it, and I have a problem, when I do it, GitHub writes me "Commit is failed". My project uses bower and nodeJS, and I understand that problems is about it, cause I download pure...

Naming conventions and file placement using Bower and Gulp


node.js,build,npm,gulp,bower
I started working with Bower and Gulp just recently. I have a bower.json listing my dependencies, a gulpfile.js with tasks for fonts, css, js, etc. and a package.json listing gulp dependencies, among other things. I have only those files under version control and as a test checked out the repository...

Gulp / Bower - maintaining consistency


node.js,gulp,bower
I feel like im missing something stupid here, can someone explain to me why i can't pull in .bowerrc into gulp? The file structure and process should be extremely simple: global.js "use strict"; var gulp = require('gulp'); var bowerRC = require('../.bowerrc'); module.exports.getBowerRC = function() { return console.log(JSON.stringify(bowerRC)); } .bowerrc {...

Strange npm behavior when installing packages like grunt


node.js,gruntjs,npm,gulp,bower
I run the following command in my bash and I get the related results: [email protected]:~$ sudo npm install -g grunt-cli /usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt [email protected] /usr/local/lib/node_modules/grunt-cli ├── [email protected] ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected]) and [email protected]:~$ grunt /usr/bin/env: node: No such file or directory I also have try to install...

Bower install doesn't seem to be working (Windows 7) - not getting bower_components directory, grunt serve cannot find bower packages


windows-7,yeoman,bower,bower-install
I'm having problems getting bower install working. I'm running through a yo webapp generator which does scaffolds out for me. In my bower.json file, it give me two dependencies: { "name": "webapp-test", "private": true, "dependencies": { "jquery": "~1.11.1", "modernizr": "~2.8.2" } } When I run a bower install after the...

How to include only specific parts of UI Bootstrap using Grunt


gruntjs,angular-ui-bootstrap,bower
I'm using the accordion, tooltips and transition components of UI Bootstrap. I can create a custom build with the online tool on the UI Bootstrap website, which will create a minified and non-minified JS file containing only the components I selected, without overhead. However, I don't want to use the...

Bower calls blocked by corporate proxy and then I get errors when updating .bowerrc


angularjs,node.js,ssl,proxy,bower
I'm trying to install bower via npm to set up the angular seed project but am running into errors that are caused by my corporate proxy. retry Request to https://bower.herokuapp.com/packages/angular failed with ECONNRESET, retrying in 1.2s bower retry Request to https://bower.herokuapp.com/packages/angular-route failed with ECONNRESET, retrying in 1.4s bower retry Request...

BowerStatic in Pyramid: why scripts aren't going to the end of body?


python-2.7,bower,pyramid
I am using pyramid_bowerstatic-0.3-py2.7, bowerstatic-0.8.1 in Pyramid 1.5.6 with SB Admin 2 bootstrap 3 theme (if that matters). When including components with, e.g. request.include(components, 'jquery') in a normally configured view (which uses template): @view_config(route_name='list', renderer='templates/list.pt', permission="view") def list_view(self): request.include(components, 'jquery') return {'project': 'My', } where (in the project __init__): components...

jQuery dependency above Angular one: WARNING: Tried to load angular more than once


jquery,angularjs,gruntjs,bower,grunt-wiredep
I am working on a Yeoman Angular-generated folder. I installed through Bower a module that requires jQuery. Grunt's wiredep places the jQuery dependency above the AngularJS in the index.html, as follows: <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/angular/angular.js"></script> <script src="bower_components/angular-animate/angular-animate.js"></script> ... <!-- endbower --> <!--...

Does an existing gruntfile need to be edited? What is the common workflow?


angularjs,gruntjs,yeoman,bower
For an existing app, is there a proper protocol for specifying bower packages such that they're handled correctly when running "grunt build"? Does an existing gruntfile need to be edited? What is the common workflow?

Cannot find .bowerrc file


php,ubuntu,proxy,bower
I am trying to install Learning Locker on my Ubuntu 14.04 which runs apache2 and php5, I have installed all the dependencies listed here. How ever when I run composer (actually its composer.phar, I dont know why) it shows that its downloading but bower shows ECONNRESET errors all along. So...

grunt bower-install of a shimmed bower dependency


node.js,gruntjs,yeoman,bower,bower-install
I've bower installed some Git repo that I need for my application and I did it by doing the following: bower install git://github.com/user/cooltool.git --save grunt bower-install and then I get the following error: cooltool was not injected in your file. Please go take a look in "app/bower_components/cooltool" for the file...

Gulp - TypeError: Cannot assign to read only property 'cwd' of bower / bootstrap.css


css,twitter-bootstrap,command-line,gulp,bower
I'm just getting to grips with Gulp.js and this is the only error I can't seem to get around. I have install bootstrap via bower, and I'm trying to minify the bootstrap css. Here's my gulp task; gulp.task('minifycss', function() { gulp.src('www/css/animate.css', 'www/bower_components/bootstrap/dist/css/bootstrap.css') .pipe(minifycss({compatibility: 'ie8'})) .pipe(gulp.dest('www-deploy/css/')); }); However when I run...

Sharing code across multiple projects in AngularJS


javascript,angularjs,bower
Firstly, I am new to AngularJS. I was wondering what are the best practices around sharing common javascript code across multiple AngularJS projects? What do the experienced AngularJS ninjas do out there? I have heard of bower....

grunt-bower-install won't include my css files


javascript,gruntjs,npm,bower
I'm quite new to bower and grunt, so basic things work bad for me. I've bower install --save bootstrap and want grunt-bower-install to update my js & css files, according to documentation It works great with the .js files, and I have successfully updated my index.html <!-- bower:js --> <script...

How to include jQuery to my app?


javascript,jquery,angularjs,gulp,bower
I'm developing the app based on angular gulp generator. I want to use the angular-ui and bootstrap components. I am able to build the application, but generated index.html file contains script tags for boostrap, angular ui but jquery is missing here. I have jquery in bower.js file and I ran...

Error to install insights ( install bower ) { OpenEdX , Ubuntu Server 12.04 }


linux,git,ubuntu-12.04,bower,openedx
I'm trying to install OpenEdX on my own SERVER (OS : Linux Ubuntu Server 12.04 ) , and i got same errors . Can anyone help me? TASK: [ insights | install bower dependencies]************************** failed: [localhost] => {"changed"; true, "cmd"; "./edx/app/insights/nodeenvs/insights/bin/activate && /edx/app/insights/edx_analystics_dashboard/node_modules/.bin/bower install --production --config.interactive=false", "delta": "0:02:32.056040", "ende"; "2015-05-01...

Load libraries with wiredep


angularjs,gulp,bower
I am doing my first steps in AngulaJS. And i try load dependences via Bower and a Gulpfile. I have instaled wiredep, gulp-inject and bower. In my Gulpfile.js i have defined the next tasks: 'use strict'; var gulp = require('gulp'); var inject = require('gulp-inject'); var wiredep = require('wiredep').stream; gulp.task('inject', function()...

cant install ionic-service-deploy


npm,ionic-framework,bower,ionic
I am using ionic and wanted to add deploy option to my code but cant install ionic-service-deploy I am trying to run ionic add ionic-service-deploy but getting error: > Failed to find the bower component "ionic-service-deploy". Are you sure it exists? (CLI v1.4.5) Your system information: Cordova CLI: 5.0.0 Ionic...

prevent bower from updating angular version


angularjs,bower
I'm trying to install angular-filter in my project using bower but the bower install git://github.com/a8m/angular-filter.git keeps updating my version of angular from 1.3.15 to angular 1.4. Here is my bower.json "name": "eeee", "version": "0.1.0", "dependencies": { "angular": ">=1.3.*", "json3": "~3.3.1", "es5-shim": "~3.0.1", "jquery": "~2.1.4", "angular-resource": ">=1.3.*", "angular-cookies": ">=1.3.*", "angular-sanitize": ">=1.3.*",...

Ionic / bower / cordova - ignore files for build


node.js,cordova,ionic-framework,bower,ionic
My project structure is the following : MyApp - hooks - platforms - android - ios - www - js / css / templates.. - lib (including all bower components) I do have a large set of bower components added to my ionic / cordova project. The www/lib directory is...

Grunt: Task “grunt-bower” not found


javascript,node.js,gruntjs,bower
I want to install package grunt-bower for my grunt by using npm install grunt-bower --save. After I install, I see package grunt-bower inside node_modules. Here is my gruntfile.js: module.exports = function(grunt) { grunt.initConfig({ bower: { dev: { dest: 'public', js_dest: 'public/javascripts', css_dest: 'public/stylesheets' } }, watch: { source: { files:...

Distribution of js library [closed]


javascript,node.js,bower,dependency-management
I want to create a js library for helping with jasmine tests. What is the js-way of distributing such library? Node modules? Bower? Both? Something else? What is the industry standard in js world?

Cannot find bower packages


angularjs,yeoman,bower,wiredep
I installed Yeoman on snow leopard OSX 6.8. When I run 'grunt serve' I get the following error (it can't find my bower packages): Dream-2:app1 goldenheart$ grunt serve Running "serve" task Running "clean:server" (clean) task >> 1 path cleaned. Running "wiredep:app" (wiredep) task Warning: Error: Cannot find where you keep...

Bower: Install package that doesn't have bower.json file


bower,bower-install
I'm trying to get Bower to install this javascript: https://github.com/markmalek/Fixed-Header-Table I use: bower install [email protected]:markmalek/Fixed-Header-Table.git --save It installs the package into bower-components, and even adds it to my project's bower.json, but it doesn't add the to my html. I'm guessing it's because that particular git repo doesn't contain a bower.json...

Node JS NPM modules installed but command not recognized


node.js,npm,bower
Node JS and NPM was working well before. Recently I have re-installed the Node JS, NPM and the problem started. After I install a module like example npm install -g bower, the module gets installed successfully but bower -v gives 'bower' is not recognized as an internal or external command,...

Grunt filerev, usemin and file caching


angularjs,caching,gruntjs,grunt-usemin
I'm using grunt filerev task to add cachebusters to files when their content changes. usemin task to replace the relevant file path with their revved versions where they are referred. Everything is setup well and they are working as expected / written in their documentation. I'll try to explain the...

Difference between bower, browserify, requirejs, webpack?


javascript,requirejs,gulp,bower,browserify
I'm used to simple and small JS projects where the JS dependencies are concatenated and minified as part of the build process using something like gulp and the script tag in the html contains the hardcoded path to that minified JS file. It's not elegant and probably has several disadvantages,...

So I have angular from bower, now what?


json,angularjs,module,bower,ngresource
I just started a new project, these are the exact steps I have taken. foundation new project_name --libsass bower install angular --dev grunt build All good, the sass files are compiling, angular is setup under bower_components inside the angular folder, but wait..... Now I need to add Angular's ng-resource module....

Revert to state before installing a bower component


angularjs,bower,restore,bower-install
I just installed angular-pdf with Bower, and in the installation process, it asked me Unable to find a suitable version for angular, please choose one: 1) angular#>=1 <1.3.0 which resolved to 1.2.28 and is required by angular-bootstrap#0.12.0 2) angular#1.3.15 which resolved to 1.3.15 and is required by angular-cookies#1.3.15, angular-pdf#0.4.0 3)...

Development Workflow - Bootstrap (Less), Bower and Grunt


twitter-bootstrap,gruntjs,less,workflow,bower
I am trying to step up my game as far as my folder structure and workflow is considered. I have recently discovered that front end package management and automation of tasks are key to improve speed, decreasing dev time, decrease file size and increase profit. My issue is I am...

Ember-cli how to add FileSaverjs and Blobjs


javascript,ember.js,bower,ember-cli
I looked at this and that link. I bower installed file-saver and Blob. I am having a similar problem with both components so I will just talk about one. When I do import FileSaver from 'file-saver'; I get the following error. Error while processing route: some.route Could not find module...

npm install: 'bower install' exited with error code 1


node.js,powershell,npm,bower
I want to programm widgets for XBee ZigBee Cloud Kit. To do it, I need first to set up everything. I'm using this guide. After failing repeatedly the automated setup I started the Manual setup. I did install the Requirements. So everything so far went good until the last point:...

What is the difference between `bower install foundation` and `foundation new MY_PROJECT`


sass,gruntjs,zurb-foundation,gulp,bower
On the foundation github page the recommended way to install foundation is bower install foundation yet in their documentation they suggest using foundation new MY_PROJECT. On the documentation page the first method is only listed under the "using a task runner" section. Both methods give different file structures. Are both...

lodash npm distribution in browser


npm,karma-runner,bower,lodash
I'm using lodash in my tests, Not using webpack or browserify (don't need to). I found that the default npm build differs from what's in bower. I could of course use bower version, but I'm curious if I can use npm's instead (it's already there for Gulp). For bower I...

Scss dependency inside scss file using bower


sass,dependencies,bower
I'm developing a scss framework similar to bootstrap for my own projects. This project is a registered bower package. And in my scss files I'm depending on another bower package that i need to @import in my other scss files. It seems that just declaring dependency in the bower.json file...

Getting a permission error when installing with bower


permissions,install,bower
Everytime I try to install something with Bower I get a permission error like this: Andreass-MacBook-Air:openMedia Andreas$ bower install jquery /usr/local/lib/node_modules/bower/node_modules/configstore/index.js:56 throw err; ^ Error: EACCES, permission denied '/Users/Andreas/.config/configstore/bower-github.yml' You don't have access to this file. at Error (native) at Object.fs.openSync (evalmachine.<anonymous>:500:18) at Object.fs.readFileSync (evalmachine.<anonymous>:352:15) at Object.create.all.get...

SyntaxError: Unexpected end of input error using Gulp and main-bower-files package


javascript,node.js,npm,gulp,bower
I keep getting an error trying to inject the main bower files into my build folder index.html I am using the main-bower-files NPM package. My code looks like this: //requires var gulp = require('gulp'); var inject = require('gulp-inject'); var config = require('./gulp-config'); var mainBowerFiles = require('main-bower-files'); gulp.task('default', ['move'], function() {...

Can't install packages -g via nvm (local profile, not sudo)


node.js,bower
I'm using nvm running node version 0.12.2. I try and install bower globally: [email protected]:~/www/busarama/src$ npm install -g bower npm ERR! tar.unpack untar error /home/karl/.npm/bower/1.4.1/package.tgz npm ERR! Linux 3.16.0-36-generic npm ERR! argv "/home/karl/.nvm/versions/node/v0.12.2/bin/node" "/home/karl/.nvm/versions/node/v0.12.2/bin/npm" "install" "-g" "bower" npm ERR! node v0.12.2 npm ERR! npm v2.7.4 npm ERR! path /usr/local/lib/node_modules npm ERR!...

occassional Unknown provider: $templateRequestProvider <- $templateRequest <- $route <- ngViewDirective error


javascript,angularjs,angular-ui-router,bower
I'm working on an angular app, and it works completely fine on computer#1, and when I've cloned the git repo on computer#2 and performed my npm install, bower install, and grunt bower-install, things fail to load. After googling around, many have cited that this is a common side effect of...

Handlebars does not output anything


javascript,gruntjs,handlebars.js,yeoman,bower
At the start of the file I define Handlebars etc.: <!-- build:js(.) scripts/vendor.js --> <!-- bower:js --> <script src="bower_components/jquery/dist/jquery.js"></script> <script src="bower_components/bootstrap/dist/js/bootstrap.js"></script> <script src="bower_components/handlebars/handlebars.js"></script> <!-- endbower --> <!-- endbuild --> At the end of the index.html-file I pull in my Handlebars-file: <!-- build:js({app,.tmp}) scripts/main.js --> <script...

How I Can Create a Yeoman or Bower repository in Nexus


javascript,yeoman,bower,nexus
Hi we have an Internal Nexus Repository for our JS artifacts How can we get the same type of Repository for Bower.io, Yeoman.io, or any other package manager beside NPM?...

Do Yo and Bower overlap in terms of functionality, and if they do is there an advantage to using both?


gruntjs,workflow,gulp,yeoman,bower
I have been using Gulp for a while now and recently started using Bower. I am now looking into whether I should also be using Yo for scaffolding, but I'm not clear on the exact purpose of Yo. I'm confused because when Yo creates an app it seems to install...

Proper Semantic-UI / Bower / Rails 4 configuration


ruby-on-rails,ruby,ruby-on-rails-4,bower,semantic-ui
I'm struggling to properly install and configure Semantic-UI using bower in my Rails 4 app. Until now, here's what I've done: Gemfile: gem "less-rails" gem "therubyracer" .bowerrc file: { "directory": "vendor/assets/components" } bower.json: { "name": "app", "version": "0.0.0", "homepage": "myapp.com", "private": true, "ignore": [ "**/.*", "node_modules", "bower_components", "vendor/assets/components", "test", "tests"...

How to install Polymer iron-elements using bower?


html,html5,polymer,bower,bower-install
How to install polymer iron and paper elements for Polymer 0.9 using bower? Tried using bower to install in a way similar to core-elements but fails. Migration guide doesn't provide any information on upgrading core/iron or paper elements. bower install Polymer/iron-elements#^0.9.0 bower iron-elements#^0.9.0 not-cached git://github.com/Polymer/iron-elements.git#^0.9.0 bower iron-elements#^0.9.0 resolve git://github.com/Polymer/iron-elements.git#^0.9.0 bower...

'Object.keys called on non-object' error when upgrading bower from version 1.3.12 to version 1.4.1


npm,bower
After I ran bower install, I got a warning: ┌───────────────────────────────────────────┐ │ Update available: 1.4.1 (current: 1.3.12) │ │ Run npm update -g bower to update. │ └───────────────────────────────────────────┘ If I follow the instruction and run the update command, I got a list of 'Object.keys called on non-object' error > npm update...

Include libraries with Composer, NPM or Bower


php,npm,composer-php,gulp,bower
I have been getting into Composer, NPM and Bower recently. I no there's a lot of overlap between their capabilities and I was wondering if my approach is sane? If not, what should I do? I typically start my PHP projects by setting up composer to load my PHP libraries...

How can I create a regex to match the inner-most match or work from right-to-left?


regex,regex-negation,regex-lookarounds,regex-greedy,grunt-usemin
I'm trying to match the strings for image references but am picking up a little too much when there's an expression involved. In this example http://www.regexr.com/3b3ub, you'll see I'm doing good on the 1st and 3rd matches but I'm getting too much in the 2nd match. I only want the...

Grunt : Usemin prepare, options for cssmin


gruntjs,grunt-usemin,grunt-contrib-cssmin
I'm using usemin in my Grunt file. I'd like to use purifycss. BUT, i get this error when running grunt : Warning: Please check the validity of the CSS block starting from the line #1 Use --force to continue. I think it's because Font Awesome is the first library in...