尝试安装浏览器同步时出错 ubuntu

Getting Error when trying to install browser-sync ubuntu

  1. 节点已更新到最新稳定版 v7.4.0

    这是我在尝试安装浏览器同步时收到的错误消息:

    sudo npm install -g browser-sync
    

'npm ERR! Linux 4.4.0-59-generic npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "browser-sync" npm ERR! node v7.4.0 npm ERR! npm v4.0.5 npm ERR! code MODULE_NOT_FOUND

npm ERR! Cannot find module 'internal/fs' npm ERR! npm ERR! If you need help, you may report this error at: npm ERR!
https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request: npm ERR! /home/pedro/npm-debug.log '

当您安装旧模块(如您的 package.json 中所写)时会出现此问题,但由于版本更新,它在 git 上不可用。

解决这个问题。

    1.Need to install the project’s local dependencies (that’s where it’s looking for browser-sync). To do that,
    2.cd into the project directory and run npm install.
    3.You can also try npm i browser-sync --save

您还需要升级 npm(目前 npm@nextnpm -g install npm@next 如果您已在全球安装它。

我已经解决了这个问题:

节点 v7 不支持 NPM 模块:

所以我降级到 node v6.4.0,它允许我安装 browser-sync 没有问题!

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n 6.9.5