I have cloned an Angular project and got the following error message
"C:\Program Files\nodejs\npm.cmd" run start
> [email protected] start
> node --max_old_space_size=4096 ./node_modules/.bin/ng serve
E:\me\Projekt\cloneFe\node_modules\.bin\ng:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.16.1
Process finished with exit code 1
my ng file lookks like this.
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../@angular/cli/bin/ng" "$@"
else
exec node "$basedir/../@angular/cli/bin/ng" "$@"
fi
i'm Running that on IntelliJ ultimate in Windows
I have tried another "node" version with vola but the error remains constant regardless of the setup.
Especially since it's a bash error, I don't know if node.js plays a role at all. Here is the comparison in a self-made angular project of the ng file
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
exec "$basedir/node" "$basedir/../@angular/cli/bin/ng.js" "$@"
else
exec node "$basedir/../@angular/cli/bin/ng.js" "$@"
fi
Nested executions is a bad idea in bash (mix of
$(...)
and also nested"..."
).Try to replace:
with:
You also could replace echo + sed with:
So, the line should be:
And finally: