0

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:

  • Uninstalling angular via npm and reinstalling
  • Uninstalling node.js and deleting npm folders, restarting machine and reinstalling
  • Creating alias's for 'ng' with the path to the ng file in the npm node_modules folder

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

1
  • Try downgrading to Node 10.13.0, and see if that helps. Commented Nov 26, 2018 at 17:07

3 Answers 3

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

I suspected that might be an issue. Is it safe to just rename that folder or is that configured somewhere in windows?
0

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.