node.js - [nodejs] Installing browser-sync encountered an error message
ringa_lee
ringa_lee 2017-05-16 13:32:32
0
1
685

[nodejs] When installing browser-sync, I encountered such an error message

$ npm install --save-dev browser-sync
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
BrowsersyncExample@1.0.0 E:\wamp\www\BrowsersyncExample
`-- browser-sync@2.18.8

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN BrowsersyncExample@1.0.0 No description
npm WARN BrowsersyncExample@1.0.0 No repository field.
npm WARN The package browser-sync is included as both a dev and production dependency.

If you ignore these error messages, run:

$ browser-sync start --server --files "css/*.css"
bash: browser-sync: command not found

This prompt will appear. .

Do you have any good solutions?

ringa_lee
ringa_lee

ringa_lee

reply all(1)
phpcn_u1582

./node_modules/.bin/browser-sync

node only has --global or -g才是全局安装的包,一般才会出现在PATH里,才可以直接运行命令,否则就在./node_modules/.bin/, 需要加上路径才可以运行,也可以在package.json里添加入口,这个入口的环境变量默认包含node_modules/.bin, you can directly

"scripts": {
  "watch": "browser-sync start --server --files 'css/*.css'"
}

Thennpm run watch

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!