node.js浏览器同步安装

时间:2016-01-08 02:55:17

标签: node.js installation browser-sync

不确定如何开始修复此问题。安装后缺少依赖项。

$ sudo npm install -g browser-sync

npm WARN install Couldn't install optional dependency: Unsupported
/usr/bin/browser-sync -> /usr/lib/node_modules/browser-sync/bin/browser-sync.js
- bindings@1.2.1 node_modules/browser-sync/node_modules/bindings
- nan@2.1.0 node_modules/browser-sync/node_modules/nan
- bufferutil@1.2.1 node_modules/browser-sync/node_modules/bufferutil
- utf-8-validate@1.2.1 node_modules/browser-sync/node_modules/utf-8-validate
- ws@0.8.1 node_modules/browser-sync/node_modules/engine.io-client/node_modules/ws
/usr/lib
└─┬ browser-sync@2.11.0 
  ├─┬ localtunnel@1.8.0
  │ └─┬ request@2.65.0
  │   └─┬ form-data@1.0.0-rc3
  │     └── async@1.5.2 
  └─┬ socket.io@1.4.1 
    └─┬ socket.io-client@1.4.1 
      └── engine.io-client@1.6.5 

到目前为止看起来还不错......但是缺少了一些东西

$ browser-sync --version          
module.js:329
    throw err;
    ^

Error: Cannot find module 'camelcase-keys'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/usr/lib/node_modules/meow/index.js:5:21)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:355:17)

好的,我尝试安装缺少的模块

sudo npm install -g camelcase-keys
/usr/lib
└─┬ camelcase-keys@2.0.0 
  ├── camelcase@2.0.1 
  └── map-obj@1.0.1 

$ browser-sync --version            
module.js:329
    throw err;
    ^

Error: Cannot find module 'map-obj'
    at Function.Module._resolveFilename (module.js:327:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:355:17)
    at require (internal/module.js:13:17)
    at Object.<anonymous> (/usr/lib/node_modules/camelcase-keys/index.js:2:14)
    at Module._compile (module.js:399:26)
    at Object.Module._extensions..js (module.js:406:10)
    at Module.load (module.js:345:32)
    at Function.Module._load (module.js:302:12)
    at Module.require (module.js:355:17)

缺少另一个模块,这种情况一直在继续。嗯有什么不对?

$ npm -v                
3.3.12

$ node -v
v5.2.0

$ node-gyp -v 
v3.2.1

1 个答案:

答案 0 :(得分:0)

您的应用是否有package.json?如果有,请转到app文件夹,然后运行命令:

npm install

sudo npm install