Node.js找不到模块 - 在Windows上干扰cygwin [英] Node.js cannot find module - interfering with cygwin on Windows
问题描述
我正在测试Bootstrap框架(来自Twitter),并尝试在安装Node.js之后在本地构建它。它失败,因为它找不到更少的模块(我也用'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错误或第一个tick时的'error'事件
^
错误:找不到模块'C:\cygdrive\c\Users\geir\AppData\Roaming \\\
pm\\\
ode_modules\less\bin\lessc'
在Function._resolveFilename(module.js:332:11)
在Function._load(module.js:279:25)
at Array.0(module.js:479:10)
在EventEmitter._tickCallback(node.js:192:40)
Makefile:2:目标`all'失败的配方
make:*** [all]错误1
cygdrive \被放在文件夹层次结构中,当make查找模块时,我已经验证thtat'lessc'实际上是在C:\Users\geir\AppData\Roaming\\\
pm\\\
ode_modules \less\bin\lessc,我可以从命令行运行它。
我试过下面没有成功:
- 在PATH env变量中重新排序文件夹,以便node.js和npm在cygwin之前 - 同样的结果。
- 使用/不使用'-g'参数(npm)安装'less'
- 重新安装节点。 js
任何人都有线索?
从Cygwin终端呼叫make。打开Cygwin终端,然后cd进入cygwin的C:\Users\geir\code\bootstrap文件夹的别名,然后运行make:
geir @ WINHOSTNAME〜
$ cd / cygdrive / c / Users / geir / code / bootstrap
geir @ WINHOSTNAME / cygdrive / c / Users / geir / code / bootstrap
$ make
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?
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
这篇关于Node.js找不到模块 - 在Windows上干扰cygwin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!