npm not responding after changing the prefix

2019-02-26 19:47发布

I tried updating my IONIC CLI through the npm recently, the installation were successful a couple of time but the CLI version did not change. After a research I decided to change the npm prefix, then the IONIC strated throwing up bash: IONIC command not found. Then I did a further research after which I edited the npm config through windows cmd admin. I did

 npm  cofig edit 

I changed the prefix to

 \users\<username>\

since then, npm no longer respond.

if I run something like

npm install -g ionic

nothing happens, no errors nor any form of response. I have uninstall and reinstall the node several time. I am using node V4.2.2.

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-02-26 20:49

I finally found a way around this . These are what I did

  1. I deleted all the node_module folders in all my application (I am not sure if this is really necessary )

  2. I did a complete uninstall of the node by following https://stackoverflow.com/a/20711410/1363169

  3. I ran

    npm root -g
    

    which returns the path

    C:\Users\<username>\node_module
    

    instead of

     /usr/local 
    

    or wherever node is installed , in my own case node is install in

     C:\Users\<username>\AppData\Roaming\npm
    

    I then ran

      npm config set prefix "C:\Users\<username>\AppData\Roaming\npm"
    

Then I reinstalled cordova and ionic again

    npm install  -g cordova
      npm install ionic -g

and all is well again

查看更多
登录 后发表回答