[英]How can i install npm in ubuntu to run less js
I have already installed node js in my ubuntu 14.04, but I am not able to install npm
in it. 我已经在我的ubuntu 14.04中安装了节点js,但是我无法在其中安装
npm
。 I want to compile less
through command line so that I need npm
. 我想通过命令行编译
less
,所以我需要npm
。
Is there any way to compile less
or how can i install npm
in ubuntu? 有没有办法编译
less
或如何在ubuntu中安装npm
?
First things first, run sudo apt-get update
. 首先,运行
sudo apt-get update
。
npm should be installed along with node.js. npm应该与node.js一起安装。 It's possible that you have a name collision issue;
您可能遇到名称冲突问题; the Ubuntu repository carries a program called 'Node' (a program for HAM radio operators) which is unrelated to node.js.
Ubuntu存储库带有一个名为'Node'的程序(一个用于HAM无线电操作员的程序),它与node.js无关。 Further, many node modules assume that 'node' refers to node.js.
此外,许多节点模块假设'node'指的是node.js.
Try removing Node: 尝试删除节点:
sudo apt-get remove node
Use which nodejs
to see where the command for node.js lives. 使用
which nodejs
来查看node.js命令的位置。 Create a symlink somewhere in your path so that node
points to nodejs
, eg 在路径中的某处创建一个符号链接,以便
node
指向nodejs
,例如
sudo ln -s [path/to/nodejs/here] /usr/bin/node
After that, /usr/bin
should be in your system's PATH variable, so you should just be able to use node.js by typing 'node'. 之后,
/usr/bin
应该在你的系统的PATH变量中,所以你应该只需输入'node'来使用node.js。 Eg try node --version
. 例如尝试
node --version
。 It should match nodejs --version
. 它应该匹配
nodejs --version
。
If none of that works, you can also try removing nodejs and node, then install nodejs-legacy, which is supposed to use the command 'node' by default. 如果这些都不起作用,您也可以尝试删除nodejs和node,然后安装nodejs-legacy,默认情况下应该使用命令'node'。 Also consider installing node.js from another source.
另请考虑从其他源安装node.js. You can find binary and source downloads at nodejs.org, or you can get the latest version from GitHub (joyent/node).
您可以在nodejs.org上找到二进制和源代码下载,也可以从GitHub(joyent / node)获取最新版本。
为什么不简单:
sudo apt-get install npm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.