Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node.js cannot find module - interfering with cygwin on Windows

I'm testing the Bootstrap framework (from Twitter) and try to build it locally after installing Node.js. It fails because it cannot find the less module (which I have also installed with 'npm install -g less'):

C:\Users\geir\code\bootstrap>make
lessc html/less/bootstrap.less > html/css/bootstrap.css

node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module 'C:\cygdrive\c\Users\geir\AppData\Roaming\npm\node_modules\less\bin\lessc'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)
Makefile:2: recipe for target `all' failed
make: *** [all] Error 1

The reason why it fails is because "cygdrive\" is prepended to the folder hierarchy when make is looking for the module, I've verified thtat 'lessc' is actually found in C:\Users\geir\AppData\Roaming\npm\node_modules\less\bin\lessc, and I can run it from the commandline.

I've tried the following without any success:

  • Reorder folders in the PATH env variable, so that node.js and npm comes before cygwin - same outcome.
  • Remove cygwin from PATH - make command is stops working.
  • install 'less' with/without '-g' parameter (npm)
  • Reinstall node.js

Anyone clues?

like image 683
Geir Avatar asked Nov 13 '22 07:11

Geir


1 Answers

Call make from the Cygwin Terminal. Open the Cygwin Terminal, then cd into cygwin's alias for your C:\Users\geir\code\bootstrap folder, then run make:

geir@WINHOSTNAME ~
$cd /cygdrive/c/Users/geir/code/bootstrap
geir@WINHOSTNAME /cygdrive/c/Users/geir/code/bootstrap
$make
like image 96
Riaz Rizvi Avatar answered Nov 17 '22 07:11

Riaz Rizvi