We've recently tried to upgrade to node v7.0.0 on our build server, but started to have issues during the application build task failing on the "bower_concat" step:
Loading "bower-concat.js" tasks...ERROR
Error: Cannot find module 'internal/fs'
What we have installed:
node
v7.0.0 (installed viayum
"nodesource" repository)npm
4.0.1- using
grunt
(if this is relevant) grunt-bower-concat
0.6.0
The grunt build task configuration:
grunt.registerTask(
'build:prod', [
'clean:prod',
'copy:prod',
'replace',
'bower_concat',
'ngtemplates',
'concat',
'uglify',
'cssmin',
'injector:prod',
'copy:cssfix',
'copy:dist',
'bowercopy:dist',
'bowercopy:fonts',
'template:setProdVersion'
]
);
And the grunt bower_concat
task:
bower_concat: {
all: {
dest: '<%= app.build %>/bower.js',
cssDest: '<%= app.build %>/bower.css',
dependencies: {
'bootstrap': 'jquery'
},
mainFiles: {
"angular-app-modules": [
"app/dist/angular-app-modules.min.js",
"app/dist/angular-app-modules.min.css"
]
}
}
},
Note that it works without any problems on node v6.9.0.
What can be causing the issue? Can we workaround the problem without downgrading to node v6?
There is also this relevant issue, but, as of now, the information there does not help in our case.
You need to install the last version of bower
Apparently, npm > 4.0 do not use internal/fs module.
On Win10 this worked for me: (adjust to relevant node version and username)
In my case clearing the cache did not work. Below was my initial state and how I resolved this:
I resolved by doing the following and using n manager:
Hope this helps!
I solve this by installing NVM to manage Node
https://github.com/creationix/nvm#installation
after install NVM, reinstall node
In linux,when I update to node 7, this happened, "npm cache clean" does work.
In windows, npm cache clean also generate
Just remove
solved