1

So I have a package.json file which I used on a different computer to run javascript tests. Now I have moved to another computer, I have the node_modules folder, package.json, package-lock.json and yarn.lock. If I run npm install in the same folder where package.json is located, shouldn't jest also be installed? Since Jest is located in package.json. If I run jest from the terminal I get command not found

skyboyer
  • 19,620
  • 7
  • 50
  • 62
Roland
  • 663
  • 1
  • 9
  • 13

2 Answers2

1

To use an npm package from anywhere you need to have it installed globally like this:

npm install -g jest

An other solloution would be to add a new script in the package.json like this:

scripts:{
   "jest":"jest"

}

And the type npm run jest

You can also have a look at this question : How to use package installed locally in node_modules?

Manos Kounelakis
  • 2,419
  • 4
  • 25
  • 48
1

Probably because the node_modules/.bin of your project is not in your $PATH try adding it or run ./node_modules/.bin/jest

CharybdeBE
  • 1,619
  • 22
  • 31