Mark O'Hare
Mark O'Hare

Reputation: 157

Angular cli not working in Git Bash terminal on Windows

I've been trying to install the Angular CLI via npm. My current node version is v11.2.0 and my npm version is 6.4.1.

After running the command npm install -g @angular/cli I get this output:

C:\Users\Mark O'Hare\AppData\Roaming\npm\ng -> C:\Users\Mark O'Hare\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@angular\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

and when I try ng -v I get this error message:

internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'C:\c\Users\Mark O'Hare\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:775:12)
    at startup (internal/bootstrap/node.js:300:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:826:3)

Things I've tried so far:

So far none of these have worked. Can anyone help or suggest a workaround?

Upvotes: 0

Views: 3209

Answers (3)

saravana manikandan
saravana manikandan

Reputation: 191

i think folder name Mark O'Hare is the issue. Instead of global installation try to install it in local and try to run the cli

Upvotes: 0

Daniel Słaby
Daniel Słaby

Reputation: 830

You can also try to use linux subsystem. I would recommend it as it's easier to make JS env working.

https://learn.microsoft.com/en-us/windows/wsl/install-win10

Upvotes: 0

Marek W
Marek W

Reputation: 729

I guess the problem lies within the user folder Mark O'Hare:

Error: Cannot find module 'C:\c\Users\Mark O'Hare\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng' --> it reads the string until the second apostrophe, which is inside O'Hare, ultimately reading the folder as

C:\c\Users\Mark O

Upvotes: 3

Related Questions