Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
512 views
in Technique[技术] by (71.8m points)

javascript - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...