简体   繁体   English

找不到 git-bash 上的全局命令 $ live-server?

[英]Global command $ live-server on git-bash can't be found?

When I try to run $ live-server globally I get the following error:当我尝试全局运行$ live-server ,出现以下错误:

C:\\Users\\name\\AppData\\Roaming\\npm/node_modules/node/bin/node: line 1: This: command not found C:\\Users\\name\\AppData\\Roaming\\npm/node_modules/node/bin/node: line 1: this: command not found

I'm thinking it must be looking in the wrong place for some reason.我想它一定是出于某种原因找错了地方。 The following returns:以下返回:

$ npm bin -g

C:\\Users\\name\\AppData\\Roaming\\npm C:\\Users\\name\\AppData\\Roaming\\npm

Anyone have any ideas why?任何人有任何想法为什么?

This is followed by node/issue 29287 which points to the same recommendation :其次是节点/问题 29287 ,它指向相同的建议

I deleted my C:/Users/{username}/AppData/Roaming/npm and C:/Users/{username}/AppData/Roaming/npm-cache and reinstalled global npm modules, and the problem ceased.我删除了C:/Users/{username}/AppData/Roaming/npmC:/Users/{username}/AppData/Roaming/npm-cache并重新安装了全局 npm 模块,问题就解决了。

It would be much better though if these steps could be avoided after upgrading/downgrading node.如果在升级/降级节点后可以避免这些步骤,那就更好了。
If not, then at least, make it explicit in the docs that this step may be necessary when upgrading/downgrading existing node installations.如果没有,那么至少在文档中明确说明升级/降级现有节点安装时可能需要执行此步骤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM