Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error when running npm start (ng serve) 'SyntaxError: missing ) after argument list' windows only

Tags:

npm

angular

when doing npm start i get the following error

C:\Users\Me\Desktop\myProject\node_modules\.bin\ng:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at Module._compile (internal/modules/cjs/loader.js:721:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Heres what my package.json is set to

  "scripts": {
    "start": "node --max_old_space_size=8192 node_modules/.bin/ng serve --configuration=dev",
    }

Its odd because when I'm on my same project, but on a mac I can get npm start to work just fine. It must be a windows thing.

Any suggestions?

like image 779
cup_of Avatar asked Dec 23 '22 22:12

cup_of


1 Answers

On Windows, don't use the ng script in the node_modules/.bin directory, but instead use the one in the @angular/cli/bin directory.

"scripts": {
    "start": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng serve --configuration=dev",
     }
like image 184
David Avatar answered Dec 27 '22 21:12

David