Skip to content

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

Closed

Description

@matt-erhart

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.

Activity

  1. guidoffm commented on Oct 1, 2016

    @guidoffm

    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
    
    
  2. maartenpaauw commented on Oct 1, 2016

    @maartenpaauw

    Tried it multiple times. Still no success.

  3. matt-erhart commented on Oct 1, 2016

    @matt-erhart
    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.

  4. filipesilva commented on Oct 8, 2016

    @filipesilva
    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

  5. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  6. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions