Problems with node and less

345 views
Skip to first unread message

TheSpiff

unread,
May 9, 2012, 3:02:27 PM5/9/12
to nod...@googlegroups.com

# test of less bin
xxx@xxx:~/less_files$ lessc test.less > out.css

node.js:249
       throw e; // process.nextTick error, or 'error' event on first tick
             ^
Error: Cannot find module 'less'
   at Function._resolveFilename (module.js:333:15)
   at Function._load (module.js:280:25)
   at Module.require (module.js:357:17)
   at require (module.js:373:17)
   at Object. (/usr/bin/lessc:7:12)
   at Module._compile (module.js:444:26)
   at Object..js (module.js:462:10)
   at Module.load (module.js:351:32)
   at Function._load (module.js:309:12)
   at module.js:482:10

# test of less within node console
xxx@xxx:~/less_files$ node
> var less = require('less');
undefined
>


# install via apt-get
…[some items omitted]
Reading package lists... Done
Building dependency tree       
Reading state information... Done
node-less is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 26 not upgraded.


# install via npm (also did -g install)
~$ npm install less
npm http GET https://registry.npmjs.org/less
npm http 200 https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/less/-/less-1.3.0.tgz
npm http 200 https://registry.npmjs.org/less/-/less-1.3.0.tgz
le...@1.3.0 ./node_modules/less

I'm fairly new to node and less, so any direction would be great!

James O'Reilly

unread,
May 10, 2012, 11:37:27 PM5/10/12
to nod...@googlegroups.com
You might have a pathing issue.  It looks like you installed less to ~/node_modules and are running your app from ~/less_files.  Node is might be looking for less globally in /usr/local/lib/node_modules/ or locally in ~/less_files/node_modules/ and not finding it in either.

Try removing the ~/node_modules folder to install modules properly when your projects are in sub-folders of ~/ like ~/less_files is.

-- JamesOR
Reply all
Reply to author
Forward
0 new messages