[英]Getting "bash: typeorm: command not found" after gloablly installing typeorm on linux
OS: macOS Sierra v 10.12.6操作系统:macOS Sierra v 10.12.6
I am trying to build an application in Typescript using the typeorm and this is my first time using either.我正在尝试使用 typeorm 在 Typescript 中构建一个应用程序,这是我第一次使用。
I've used both of the following to install typeorm:我已经使用以下两种方法来安装 typeorm:
npm i -g typeorm
& &
sudo npm i -g typeorm
And am seeing the following in the terminal after installing:安装后在终端中看到以下内容:
+ typeorm@0.2.21
added 127 packages from 406 contributors in 7.081s
But when trying to use typeorm CLI commands:但是当尝试使用 typeorm CLI 命令时:
typeorm init --name jwt-express-typeorm --database sqlite --express
I keep getting this error:我不断收到此错误:
bash: typeorm: command not found
I've tried uninstalling the package globally using:我尝试使用以下方法全局卸载软件包:
sudo uninstall typeorm -g --save
and reinstalling afterward but still getting the same error.然后重新安装,但仍然出现相同的错误。 Any help would would be super appreciated!任何帮助将不胜感激!
If you don't care to add the global node_modules
folder (not just the project one) to your $PATH
, you can use npx {command-name}
instead.如果您不想将全局node_modules
文件夹(不仅仅是项目文件夹)添加到您的$PATH
,您可以使用npx {command-name}
代替。 The global node_modules
folder's location depends on your OS.全局node_modules
文件夹的位置取决于您的操作系统。 See Where does npm install packages?请参阅npm 在哪里安装软件包? . . One benefit of using npx
, however, is that it works with all packages, not just globally installed ones.然而,使用npx
一个好处是它适用于所有软件包,而不仅仅是全局安装的软件包。
尝试在typeorm
之前附加npm run
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.