When you try to run grunt build, the following error crashes:
Loading "bower-concat.js" tasks ... ERROR
>> Error: Cannot find module 'internal / fs'
Warning: Task "bower_concat" not found. Use --force to continue.
Dependencies in package.json
"dependencies": { "grunt": "^0.4.5", "connect-livereload": "^0.5.3", "grunt-contrib-connect": "^0.11.2", "grunt-contrib-jshint": "^0.11.3", "grunt-contrib-livereload": "^0.1.2", "grunt-contrib-watch": "^0.6.1", "grunt-contrib-copy": "", "grunt-contrib-clean": "", "http-server": "^0.6.1", "jshint": "^2.8.0", "grunt-bower-concat": "^0.6.0", "grunt-bower-task": "^0.4.0", "grunt-cli": "^0.1.13", "grunt-contrib-concat": "^0.5.1", "grunt-contrib-cssmin": "^0.14.0", "grunt-contrib-htmlmin": "^0.6.0", "grunt-contrib-uglify": "^0.11.0", "grunt-usemin": "^3.1.1" } Gruntfile.js
module.exports = function (grunt) { grunt.initConfig({ clicknet: { app: 'app', dist: 'dist' }, connect: { options: { port: 9000, // Change this to '0.0.0.0' to access the server from outside. hostname: '0.0.0.0', livereload: 35729, base: 'app' }, livereload: { options: { open: true } } }, watch: { gruntfile: { files: ['Gruntfile.js'] }, scripts: { files: '<%= clicknet.app %>/style/**/*.css', options: { interrupt: true } } }, jshint: { options: { node: true, jshintrc: '.jshintrc' }, all: { src: [ '<%= clicknet.app %>/components/**/*.js', '<%= clicknet.app %>/shared/**/*.js' ] } }, copy: { dist: { files: [ { expand: true, cwd: 'app', dest: '<%= clicknet.dist %>', src: [ '**/*.html', 'shared/directives/**/*.html', 'images/**/*', 'font/**/*', '!bower_components/**' ] }/*, { expand: true, cwd: 'app/bower_components/jquery-ui/themes/base/images/', src: '**', dest: '<%= clicknet.dist %>/style/images', flatten: true }*/ ] } }, clean: { dist: { files: [{ dot: true, src: [ '.tmp', '<%= clicknet.dist %>/{,*/}*', '!<%= clicknet.dist %>/.git{,*/}*' ] }] } }, useminPrepare: { html: '<%= clicknet.app %>/index.html', options: { dest: '<%= clicknet.dist %>', flow: { html: { steps: { js: ['concat', 'uglify'], css: ['cssmin'] }, post: {} } } } }, usemin: { html: ['<%= clicknet.dist %>/{,*/}*.html'], css: ['<%= clicknet.dist %>/style/{,*/}*.css'], options: { assetsDirs: [ '<%= clicknet.dist %>', '<%= clicknet.dist %>/images', '<%= clicknet.dist %>/style' ] } }, concat: { js: { files: [ { dest: '.tmp/scripts/main.js', src: [ '<%= clicknet.app %>/app.js', '<%= clicknet.app %>/app.prod.config.js', '<%= clicknet.app %>/app.info.prod.service.js', '<%= clicknet.app %>/components/**/*.js', '<%= clicknet.app %>/shared/**/*.js' ] } ] }, css: { files: [ { src: [ 'style/*.css', 'bower_components/bootstrap/dist/css/bootstrap.min.css', 'bower_components/perfect-scrollbar/css/perfect-scrollbar.min.css', 'bower_components/slick-carousel/slick/slick.css' ], dest: '.tmp/style/main.css' } ] } }, cssmin: { css: { src: '.tmp/style/main.css', dest: '<%= clicknet.dist %>/style/main.min.css' } }, uglify: { options: { mangle: false }, js: { files: { '<%= clicknet.dist %>/scripts/main.min.js': '.tmp/scripts/main.js' } }, bower: { options: { compress: true }, files: { '<%= clicknet.dist %>/scripts/vendor.min.js': '.tmp/scripts/vendor.js' } } }, bower_concat: { options: { separator: '\r\n' }, all: { dest: '.tmp/scripts/vendor.js', bowerOptions: { relative: false } } }, bower: { install: { options: { copy: false } } }, htmlmin: { dist: { options: { collapseWhitespace: true, conservativeCollapse: true, collapseBooleanAttributes: true, removeCommentsFromCDATA: true, removeOptionalTags: true }, files: [{ expand: true, cwd: '<%= clicknet.dist %>', src: [ '**/*.html' ], dest: '<%= clicknet.dist %>' }] } } }); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-livereload'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-clean'); grunt.loadNpmTasks('grunt-usemin'); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-bower-task'); grunt.loadNpmTasks('grunt-bower-concat'); grunt.loadNpmTasks('grunt-contrib-htmlmin'); grunt.registerTask('serve', 'Compile then start a connect web server', function () { grunt.task.run([ 'connect:livereload', 'watch' ]); }); grunt.registerTask('build', [ 'clean:dist', 'bower:install', 'useminPrepare', 'bower_concat', 'concat', 'uglify:js', 'uglify:bower', 'cssmin', 'copy', 'usemin', 'htmlmin' ]); }; - Version node 7.0.0
- Npm version 4.0.2
- Windows 10
How I tried to solve this problem:
- Cleaned the cache
npm cache clean - Removed the project's global node_modules and node_modules. I reinstalled and got the same error.