简体   繁体   中英

Getting "bash: typeorm: command not found" after gloablly installing typeorm on linux

OS: 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.

I've used both of the following to install 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 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. The global node_modules folder's location depends on your OS. See Where does npm install packages? . One benefit of using npx , however, is that it works with all packages, not just globally installed ones.

尝试在typeorm之前附加npm run

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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