Skip to content

PSA: if ng -v returns an error. #2462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matt-erhart opened this issue Oct 1, 2016 · 5 comments
Closed

PSA: if ng -v returns an error. #2462

matt-erhart opened this issue Oct 1, 2016 · 5 comments

Comments

@matt-erhart
Copy link

For some unknown reason, ng commands stopped working. A lot of other people on various OSs were having a similar problem. I uninstalled npm, uninstalled node, and deleted the global node_modules folder, and installed the latest version of everything and got ng commands working again. Search for a 'complete' uninstall of npm/node to find your global node_modules folder for your OS.

@guidoffm
Copy link

guidoffm commented Oct 1, 2016

I get this error:

C:\Users\guido>npm -v
3.10.5

C:\Users\guido>node -v
v6.2.2

C:\Users\guido>ng -v
fs.js:634
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

TypeError: path must be a string or Buffer
    at TypeError (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at Function.Version.fromProject (C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\upgrade\version.js:87:31)
    at Function.Version.isPreWebpack (C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\upgrade\version.js:111:31)
    at Function.Version.assertPostWebpackVersion (C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\upgrade\version.js:97:18)
    at C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\bin\ng:25:15
    at C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\node_modules\resolve\lib\async.js:44:21
    at ondir (C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\node_modules\resolve\lib\async.js:187:31)
    at C:\Users\guido\AppData\Roaming\npm\node_modules\angular-cli\node_modules\resolve\lib\async.js:153:39

@maartenpaauw
Copy link

Tried it multiple times. Still no success.

@matt-erhart
Copy link
Author

Hmmm, what I did worked for windows 10. I suspect the trick is to find all the files node/npm have placed around your OS to get a true clean slate.

@filipesilva
Copy link
Contributor

@matt-erhart that's my recommendation for when ng commands stop working overall. There might be a bunch of causes for it though... I tried to gather the common ones in https://github.com/angular/angular-cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22type%3A%20faq%22%20 .

I appreciate you sharing your solution, but I can't keep this issue open as it's not actionable.

@guidoffm that specific issue is #2178

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants