Answer the question
In order to leave comments, you need to log in
Node.js and less, module connection error, what's the problem?
1) Installed Less: npm install -g less In the less console, everything works fine.
2) I write the following code:
var less = require.resolve('less');
less.render('.test {width: 1+1px;}', function(e, output){
console.log(output.css);
});
3) I start in the console (phpStorm, there is a standard terminal from Windows) and
C:\OpenServer\domains\less>node compiler
module.js:529
throw err;
^
Error: Cannot find module 'less'
at Function.Module._resolveFilename (module.js:527:15)
at Function.resolve (internal/module.js:18:19)
at Object. (C:\OpenServer\domains\less\compiler.js:1:82)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module .js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:187:16)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question