npm更改前缀后没有响应

时间:2022-07-23 19:41:20

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更新我的IONIC CLI,安装成功了几次但CLI版本没有改变。经过研究后我决定更改npm前缀,然后IONIC strated抛出bash:未找到IONIC命令。然后我做了进一步的研究,之后我通过windows cmd admin编辑了npm配置。我做到了

 npm  cofig edit 

I changed the prefix to

我将前缀更改为

 \users\<username>\

since then, npm no longer respond.

从那时起,npm不再回应。

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.

没有任何反应,没有错误,也没有任何形式的回应我有几次卸载并重新安装节点。我正在使用节点V4.2.2。

1 个解决方案

#1


2  

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 )

    我删除了所有应用程序中的所有node_module文件夹(我不确定这是否真的有必要)

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

    我按照https://*.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

然后我再次重新安装了cordova和离子

    npm install  -g cordova
      npm install ionic -g

and all is well again

一切都很好

#1


2  

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 )

    我删除了所有应用程序中的所有node_module文件夹(我不确定这是否真的有必要)

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

    我按照https://*.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

然后我再次重新安装了cordova和离子

    npm install  -g cordova
      npm install ionic -g

and all is well again

一切都很好