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

时间:2017-02-02 04:25:12

标签: node.js ubuntu npm browser-sync

  1. 节点已更新至最新的稳定版本v7.4.0

    这是我在尝试安装browser-sync时收到的错误消息:

    sudo npm install -g browser-sync
    
  2.   

    ' npm ERR! Linux 4.4.0-59-generic npm ERR! argv" / usr / local / bin / node"   "在/ usr / local / bin中/ NPM" "安装" " -g" "浏览器的同步"错误的ERR!节点   v7.4.0 npm ERR! npm v4.0.5 npm ERR!代码MODULE_NOT_FOUND

         

    npm ERR!找不到模块' internal / fs'错误的ERR!错误的ERR!如果你   需要帮助,您可以在以下地址报告此错误:npm ERR!
      https://github.com/npm/npm/issues

         

    npm ERR!请在任何支持请求中包含以下文件:   错误的ERR! /home/pedro/npm-debug.log'

3 个答案:

答案 0 :(得分:1)

当您安装旧模块(如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

答案 1 :(得分:0)

如果您已全局安装,则还需要升级npm(目前为npm@next - npm -g install npm@next

答案 2 :(得分:0)

我已解决了这个问题:

节点v7不支持NPM模块:

所以我降级到节点v6.4.0,它允许我安装浏览器同步没有问题!

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