Currently, I am working on enhancing my node script that is responsible for converting a modified LESS file to CSS. However, the script is generating redundant CSS code, so I decided to use a module to "minify" it. I have attempted to use both the official LESS module and a third-party one, but unfortunately, neither of them seems to be working.
Although both modules function properly via the command line, I encounter an error when trying to import them into the script:
module.js:338
throw err;
^
Error: Cannot find module 'clean-css'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (M:\Sped\Custom CSS\compile.js:12:16)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
I have made multiple attempts to install the modules, with and without the -g
flag (which I am unsure of its purpose).
While I have come across similar questions, they typically involve being able to import the modules into the script but facing issues with command line use, and those instances were on Mac or Linux systems.
For context, I am using Windows 10 64-bit.
If anyone could provide guidance on how I can resolve this issue, it would be greatly appreciated.