1

I'm developing an node app during a fullstack web development bootcamp, my problem started when I installed two development dependencies to my project: npm-run-all and browser-sync. Both of then with the purpose of automatize the reload of the browser page when I change and save some file.

Here folows my terminal error:

YError: Invalid first argument. Expected boolean or string but received function.
    at argumentTypeError (C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\yargs\build\lib\argsert.js:64:11)
    at C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\yargs\build\lib\argsert.js:45:17
    at Array.forEach (<anonymous>)
    at Object.argsert (C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\yargs\build\lib\argsert.js:38:25)
    at Object.version (C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\yargs\build\lib\yargs.js:796:19)
    at runFromCli (C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\browser-sync\dist\bin.js:46:10)    
    at Object.<anonymous> (C:\Users\edson\Desktop\launchBaseBootcamp\ControleDeAcademia\node_modules\browser-sync\dist\bin.js:38:5)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
    at Module.load (internal/modules/cjs/loader.js:1002:32)

Here is my scripts configuration in package.json:

{
  "name": "ControleDeAcademia",
  "version": "1.0.0",
  "main": "server.js",
  "scripts": {
    "start": "npm-run-all -p nodemon browsersync",
    "nodemon": "nodemon server.js",
    "browsersync": "browser-sync start --proxy http://localchost:5000 --files 'public,views'"
  },
  "dependencies": {
    "express": "^4.17.1",
    "nunjucks": "^3.2.1"
  },
  "devDependencies": {
    "browser-sync": "^2.26.10",
    "nodemon": "^2.0.4",
    "npm-run-all": "^4.1.5"
  }
}

Indeed, I receive the the msg from nodemon that the server is running, and from browser-sync that it is proxing my server, as you can see bellow:

nodemon starting `node server.js`
server is running
Browsersync Proxying: http://localhost:5000
Browsersync Access URLs:
 -------------------------------------
       Local: http://localhost:3000
    External: http://192.168.56.1:3000
 -------------------------------------
          UI: http://localhost:3001
 UI External: http://localhost:3001
 -------------------------------------
Browsersync Watching files.

But when I go to my browser window, I got a empty response error and the page never loads:

Error_Image

Jabster28
  • 177
  • 11

2 Answers2

0

check your code in index.js file and ensure the type of data you put in a file, and as I read the problem in Array.forEach () you must check code the error it's not in script package json

Hassan Al Najjar
  • 324
  • 1
  • 4
  • 13
0

Felt a little bit embarrassed whenI realized that my server wasn't working due to a miss type on my package.json file. If you guys look at the scripts/browsersync property, you'll se that I wrote http://localchost:5000 witch a "c" between the l and the h, instead of http://localhost:5000. I've deleted the c and my server worked fine. But, curioulsy, I still get the yError message, however, apparently, it doesn't affect my server.