1

I get the following error when trying to run css minification from GruntJs and I have no clue why.

Loading "cssmin.js" tasks...ERROR 
>> Error: Cannot find module '_stream_transform

What is the origin of this error message? I've search through the cssmin.js file and can't find a single reference to that module.

4

2 回答 2

6

Hoang's answer should not be acceptable, because it requires you to locally make changes to a node module from the NPM registry.

What happens when someone pulls your repository, and runs NPM install ... or if you update the module?

The fix: I came across the same problem and found that simply updating node (using NVM in my case) fixed it for me.

于 2014-07-29T15:36:36.307 回答
0

I've the same problem. Go to grunt-contrib-cssmin/node_modules/maxmin/node_modules/gzip-size/node_modules/browserify-zlib and install the readable-stream module

npm install readable-stream

Then modify this file grunt-contrib-cssmin/node_modules/maxmin/node_modules/gzip-size/node_modules/browserify-zlib/src/index.js

  • replace:

    var Transform = require('_stream_transform');

  • by:

    var Transform = require('readable-stream').Transform;

It works for me and I hope this could help you.

于 2014-07-12T18:29:43.360 回答