Error: Cannot find the browser-sync module

When I try to run gulp serve This causes an error

module.js: 338 throw an error; ^

Error: Cannot find the browser-sync module

 at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (/home/sajad/p_projects/my-project/gulpfile.js:17:19) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) at require (module.js:384:17) 

After that I tried sudo npm rm browser-sync && npm install browser-sync its incremental error

npm ERR! Linux 3.13.0-24-generic

npm ERR! argv "/ usr / bin / node" "/ usr / bin / npm" "install" "browser synchronization" npm ERR! node v0.12.7 npm ERR! npm v2.11.3 npm ERR! file /home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR! EJSONPARSE code

npm ERR! Failed to parse json npm ERR! No data, empty input at 1: 1 n / m ERR! npm ERR! ^ npm ERR! File: /home/sajad/.npm/escape-html/1.0.2/package/package.json npm ERR! Failed to parse package.json data. npm ERR! package.json should be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not an error in npm. npm ERR! Tell the package author to fix his package .json file. JSON.parse

npm ERR! Please include the following file with any support request: npm ERR! /Home/sajad/p_projects/my-project/npm-debug.log

Tell me how to run gulp serve and how to fix this error.

+6
source share
4 answers

I tried these steps. His work is for me.

Install gulp globally.

Next, you need to install the local dependencies of the projects (where he is looking for synchronization with the browser). For this

cd into the project directory and run npm install .

Then try gulp serve .

You can also try the following lines

npm i browser-sync --save then

 npm start 
+7
source

I also had the same problem, I was able to solve it by introducing this.

npm i browser-sync --save

Check out this link here: https://github.com/brawlins/react-webpack-php-starter/issues/1

+12
source

You can try:

 npm cache clean 

as it looks like it is not related to your project, but your npm files, and then run npm install

+5
source

Are you for the proxy? Since this happened once at the company, this particular node module will not be installed due to the proxy server. I had to install it without a proxy in order for it to work. Just try using your phone or other network.

0
source

All Articles