Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module 'browser-sync'

When am trying to start gulp serve Its raise an error

module.js:338 throw err; ^

Error: Cannot find module 'browser-sync'

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 raise follwing error

npm ERR! Linux 3.13.0-24-generic

npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "browser-sync" 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! code EJSONPARSE

npm ERR! Failed to parse json npm ERR! No data, empty input at 1:1 npm 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 must be actual JSON, not just JavaScript. npm ERR! npm ERR! This is not a bug in npm. npm ERR! Tell the package author to fix their 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

Guide me how to start gulp serve and how resolve these error

like image 938
Sajjad Murtaza Avatar asked Oct 18 '15 16:10

Sajjad Murtaza


2 Answers

I also had a same problem, I was able to solve it by entering this.

npm i browser-sync --save

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

like image 126
achooan Avatar answered Oct 16 '22 13:10

achooan


I tried these steps. Its work for me.

Globally install gulp.

Next need to install the project’s local dependencies (that’s where it’s looking for browser-sync). To do that,

cd into the project directory and run npm install.

Then try gulp serve.

You can also try following lines

npm i browser-sync --save then

npm start
like image 13
Sajjad Murtaza Avatar answered Oct 16 '22 13:10

Sajjad Murtaza