很抱歉成为100万人创造了一个类似的主题,但我真的读过所有其他人,他们根本没有帮助我。我尝试通过以下方式正确设置“路径”:设置PATH =%PATH%; C:\ Users \“您的用户名”\ AppData \ Roaming \ npm。无论我的努力如何,它仍然无效。我已经尝试重新安装它,甚至在我的主驱动器上重新安装GIT只是为了看看路径是否会有差异但仍为零。在这里,我已经粘贴了GIT提示符的输出。如果有人有任何想法如何解决它,我愿意接受建议。
$ npm install -g bower
D:\Programs\GIT\Git\usr\local\bower -> D:\Programs\GIT\Git\usr\local\node_mods\bower\bin\bower
bower@1.7.9 D:\Programs\GIT\Git\usr\local\node_modules\bower
Kosio@User MINGW64 ~/Desktop/Web Projects/RESTful API/bookstore/client
$ which bower
which: no bower in (/c/Users/Kosio/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/:/mingw64/bin:/usr/bin:/c/Users/Kosio/bin:/c/Program Files (x86)/NVIDIA Corpoion/PhysX/Common:/c/ProgramData/Oracle/Java/javapath:/c/Program Files (x86)/Il/iCLS Client:/c/Program Files/Intel/iCLS Client:/c/WINDOWS/system32:/c/WINDO/c/WINDOWS/System32/Wbem:/c/WINDOWS/System32/WindowsPowerShell/v1.0:/c/Prograiles/Intel/Intel(R) Management Engine Components/DAL:/c/Program Files/Intel/Il(R) Management Engine Components/IPT:/c/Program Files (x86)/Intel/Intel(R) Mgement Engine Components/DAL:/c/Program Files (x86)/Intel/Intel(R) Managementgine Components/IPT:/c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Pram Files (x86)/Intel/OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/Windows LiShared:/c/Program Files (x86)/MiKTeX 2.9/miktex/bin:/c/Program Files (x86)/Gtarp/2.12/bin:/c/Program Files (x86)/Skype/Phone:/c/WINDOWS/system32/config/symprofile/.dnx/bin:/c/Program Files/Microsoft DNX/Dnvm:/d/Programs/Node JS:/cmc/Program Files/MongoDB/Server/3.2/bin:/usr/bin/vendor_perl:/usr/bin/core_per
答案 0 :(得分:3)
看起来你正在使用Git Bash。此命令无法设置PATH=%PATH%;C:\Users\ "Your username" \AppData\Roaming\npm
:
PATH="$PATH:/c/Users/username/AppData/Roaming/npm"
尝试这样写:
PATH="$PATH:"'C:\Users\username\AppData\Roaming\npm'
或者这可能也有效,但我现在无法测试它:
PATH
你PATH
也很长。我建议使用自定义 John Joan
Smith, Jones, Smith,
Index1 234 432 324
Index2 2987 234 4354
,只包含Node.js开发必需的路径,以减少噪音和意外行为。