Linux上的Browsersync

时间:2015-12-15 13:37:26

标签: linux node.js ubuntu browser-sync

我使用命令行在Ubuntu上安装了Browsersync

npm install -g browser-sync

现在,我去检查版本:

browser-sync --version

我收到错误消息:

/usr/bin/env: node: No such file or directory

我现在该怎么办?

3 个答案:

答案 0 :(得分:4)

您需要创建一个符号链接,因为npm安装程序不会这样做。

ln -s /usr/bin/nodejs /usr/bin/node

在此记录: https://nodejs.org/en/download/package-manager/

答案 1 :(得分:0)

我修复了安装nodejs-legacy:

sudo apt-get install nodejs-legacy

然后检查回来工作:

ihab@ihab-pc:~$ node --version
The program 'node' can be found in the following packages:
 * node
 * nodejs-legacy
Try: sudo apt-get install <selected package>
ihab@ihab-pc:~$ sudo apt-get install nodejs-legacy
[sudo] password for ihab: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  nodejs-legacy
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.6 kB of archives.
After this operation, 122 kB of additional disk space will be used.
Get:1 http://eg.archive.ubuntu.com/ubuntu/ wily/universe nodejs-legacy all 0.10.25~dfsg2-2ubuntu1 [14.6 kB]
Fetched 14.6 kB in 0s (32.9 kB/s)      
Selecting previously unselected package nodejs-legacy.
(Reading database ... 232447 files and directories currently installed.)
Preparing to unpack .../nodejs-legacy_0.10.25~dfsg2-2ubuntu1_all.deb ...
Unpacking nodejs-legacy (0.10.25~dfsg2-2ubuntu1) ...
Processing triggers for man-db (2.7.4-1) ...
Setting up nodejs-legacy (0.10.25~dfsg2-2ubuntu1) ...
ihab@ihab-pc:~$ browser-sync --version
2.10.1

感谢@Biffen提示:)

答案 2 :(得分:0)

我遇到了一个类似的问题,我通过删除有问题的现有符号链接并创建一个新符号来解决这个问题:

  • sudo rm / usr / bin / node
  • sudo ln -s / usr / bin / nodejs / usr / bin / node

希望它对某人有帮助, 干杯