在git-bash上找不到npm-cli.js [英] npm-cli.js not found on git-bash

查看:51
本文介绍了在git-bash上找不到npm-cli.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在Windows上安装了nodejs和npm.一切都很好.但是,由于某些原因,npm确实可以在cmd中工作,但是在git-bash上调用时会出现以下错误.

I have recently installed nodejs and npm on windows. Everything is fine with it. However, for some reason npm does work in cmd, but gives the following error when called on git-bash.

module.js:327
    throw err;
 ^

Error: Cannot find module 'B:\b\programma's\Nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3
module.js:327
    throw err;
    ^

Error: Cannot find module 'B:\b\programma's\Nodejs\node_modules\npm\bin\npm-cli.js'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:974:3

我注意到路径似乎是B:\ b \,这意味着npm会两次选择驱动器.

I noticed that the path apears to be B:\b\, meaning that somewhere npm selects the drive twice.

我知道我的问题很像这个问题.我确实检查了我的Windows PATH变量,并且其中有nodejs文件夹(包括npm文件夹).

I am aware of the fact that my question looks a lot like this question. I did check my windows PATH variable, and the nodejs folder(including npm folder) are in there.

我还看到了帖子和git-bash不会告诉我找不到npm

I also saw this post, and the git-bash does not tell me that npm is not found

我希望有人可以帮助我解决这个问题

I hope someone can help me with this problem

推荐答案

好像您的目录中有一个'.我会备份所有内容,将该目录更改为类似 prog 的简单名称,而没有任何标点符号,卸载Node和git-bash,并非常仔细地按照说明进行操作,以重新安装它们.

Looks like one of your directories has a ' in it. I would back everything up, change that directory to something simple like prog without any punctuation, uninstall Node and git-bash, and very carefully follow the instructions reinstalling them.

这篇关于在git-bash上找不到npm-cli.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆