本文介绍了节点找不到较少的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Ubuntu 12.1上安装Node and Less.安装似乎可以正常进行,我可以看到在使用"sudo npm g install less"安装Less时创建了一个Less文件夹:
I am trying to install Node and Less on Ubuntu 12.1. Installing appears to work ok and I can see there is a Less folder created when I install Less using "sudo npm g install less" in:
/usr/local/lib/node_modules
/usr/local/lib/node_modules
但是,当我运行"lessc -v"时,我得到以下信息:
However when I run "lessc -v" I get the below:
module.js:340
throw err;
^
Error: Cannot find module 'less'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/usr/bin/lessc:8:12)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
有什么想法我要去哪里吗?
Any ideas where I am going wrong?
推荐答案
您应该创建到节点模块目录的符号链接到您的主目录中.
You should create symlink to node modules directory into your home directory.
$ ln -s /usr/lib/node_modules/ ~/.node_libraries
(如果您是从源安装的,则它将是/usr/local/lib/node_modules)
(if you installed node from source it'll be /usr/local/lib/node_modules)
这篇关于节点找不到较少的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!