Search code examples
typeorm

Typeorm: Command not recognized


I am trying to install and initiate the Typeorm but it gives me an error; I have tried to search about it but nothing seems to work.

First I ran this in the cmd npm i typeorm -g and then typeorm init --name backend-proj-one --database postgres

typeorm : The term 'typeorm' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try 
again.
At line:1 char:1
+ typeorm init --name backend-proj-one --database postgres
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (typeorm:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
   

Would you be able to help me?

Ty so much, that would really mean a lot

I was expecting to have the basic files added to my project


Solution

  • It looks like you are trying to run the typeorm command in your terminal, but the terminal is unable to recognize it.

    There are a few things you can try to resolve this issue:

    Make sure you have installed typeorm correctly by running npm i typeorm in your terminal. This should install typeorm locally in your project.

    Make sure you have installed typeorm globally by running npm i -g typeorm. This will allow you to run the typeorm command from any location on your machine.

    If you have installed typeorm both locally and globally, try running the command with the npx prefix, like this: npx typeorm init --name backend-proj-one --database postgres. This will use the locally-installed version of typeorm rather than the global version.

    If none of the above solutions work, it's possible that there is a problem with your Node.js or npm installation. You can try reinstalling Node.js and npm to see if that resolves the issue.