Missing dependencies
ThiefMaster opened this issue · 1 comments
ThiefMaster commented
I'm not using sourcemaps, so I didn't install any of the related packages. However, this results in an error when just adding cleanCSS()
to the gulp pipeline:
Error: Cannot find module 'source-map'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adrian/dev/gamesurge/web/node_modules/gulp-clean-css/node_modules/clean-css/lib/stringifier/source-maps.js:1:88)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
After installing source-map
:
Error: Cannot find module 'readable-stream'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/adrian/dev/gamesurge/web/node_modules/gulp-clean-css/node_modules/gulp-util/node_modules/multipipe/node_modules/duplexer2/index.js:1:76)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
After installing readable-stream
it worked.
However, should it really be up to whoever uses this package to install these dependencies? IMO the package.json of gulp-clean-css
should specify them as dependencies!
scniro commented
Something must be wrong with your node module installation...
npm install gulp-clean-css
brings down all the dependencies specified in package.json
"clean-css": "^3.4.23",
"gulp-util": "^3.0.7",
"object-assign": "^4.1.0",
"through2": "^2.0.3",
"vinyl-sourcemaps-apply": "^0.2.1"
Cracking open the source, you'll see all the required dependencies in index.js
(reordered for readability)
const CleanCSS = require('clean-css');
const PluginError = require('gulp-util').PluginError;
const objectAssign = require('object-assign');
const through = require('through2');
const applySourceMap = require('vinyl-sourcemaps-apply');
const path = require('path'); // native
1:1 mapping - nothing seems out of place here