1

I'm currently using Browser Sync newest version (2.24.6) installed via npm install -g browser-sync and I did so in my C:\Users\USERNAME\Google Drive I am using Gulp.

I start browser sync by running browser-sync start --server --files '*.html, css/*.css, js/*.js' in bash and my project opens up. The project updates as expected when I change HTML, CSS, and/or JS files.

However, when I edit my package.json file (which is not in the same directory) under "scripts" with "start": browser-sync start --server --files '*.html, css/*.css, js/*.js' and then run npm start in my bash console I get a page but all I see is Cannot GET / and not my project.

Also, if I try to browser-sync start --server --files '*.html, css/*.css, js/*.js' or in any other project I get the same error.

If I do gulp browser-sync this is what I get:

[06:03:14] Working directory changed to ~\Google Drive
[06:03:15] Using gulpfile ~\Google Drive\gulpfile.js
[06:03:15] Starting 'browser-sync'...
[Browsersync] Access URLs:
 --------------------------------------
       Local: http://localhost:3000
    External: http://192.168.1.116:3000
 --------------------------------------
          UI: http://localhost:3001
 UI External: http://192.168.1.116:3001
 --------------------------------------
[Browsersync] Serving files from: ./

Here is my gulpfile.js :

const gulp = require("gulp");
const browserSync = require('browser-sync').create();

gulp.task('browser-sync', function () {
  browserSync.init({
     server: {
        baseDir: './',
     }
  });
});

And here is my package.json file:

{
  "name": "eslint-test",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "dependencies": {
    "browser-sync": "^2.24.6",
    "gulp-sass": "^4.0.1"
  },
  "devDependencies": {
    "eslint": "^4.18.1",
    "eslint-config-airbnb-base": "^12.1.0",
    "eslint-plugin-import": "^2.9.0",
    "gulp": "^4.0.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "browser-sync start --server --files '*.html, css/*.css, js/*.js'"
  },
  "author": "",
  "license": "ISC"
}

I apologize if this is not the right place but I have searched and watched videos for about 2 hours with no answers found. I appreciate any and all help/links.

Jonathan Sexton
  • 129
  • 2
  • 9

0 Answers0