Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ENOTSUP using Grunt

I'm using Grunt to minify and concatenate files for an AngularJS web application. Our source is on a file share and I'm connecting to it via a mapped drive. Whenever Grunt runs over my source directory, I get an error on one of my concat tasks. The error is "ENOTSUP, operation not supported on socket". If I copy the source, local, Grunt runs, fine. For the sake of our source control, I need Grunt to watch and run over the mapped drive. The concat task uses grunt-contrib-concat. I've tried reinstalling Node and rolling back grunt-contrib-concat to version 0.4.0. That didn't work. Any help/ideas would be greatly appreciated.

Edit:

The code in Grunt that gives the error is:

  jscustom: {
            src: ['src/js/*.js', 'src/js/**/*.js', 'build/temp/templates.js'],
            dest: 'build/temp/custom.js'
}

If I remove "'src/js/**/*.js'," from the code, above, and excute my Grunt task, the ENOTSUP error does not occur. I need to use those wild cards to include all directories and files.

like image 245
Lee Duckworth Avatar asked Dec 01 '22 14:12

Lee Duckworth


1 Answers

We've ran into this problem when we started deploying to Azure.

The problem is most likely caused by a bug in glob (on which Grunt has an dependency).

This bug is long since been fixed (see github issue 205), but unfortunately the latest stable release on NPM is 0.4.5 (published two years ago) - which has an dependency on glob version 3.1.21 (current version is 6.0.4).

So fixes for this are either:

a) get grunt by cloning from github instead of using npm

or

b) after npm install, navigate to /node_modules/grunt and execute an npm install glob@^6.0.4 --save to upgrade the glob dependency of the installed grunt version.

In your deploy.sh, the npm install may look like this:

eval $NPM_CMD install

You'll want to add the following right after it

pushd ./node_modules/grunt
eval $NPM_CMD install glob@^6.0.4 --save
popd

Note; changing the /**/ to /*/ gets rid of the error, but then you give up the recursive copy.

like image 146
mrcl Avatar answered Dec 04 '22 03:12

mrcl