Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get this error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)?

I tried a lot, but my projects don't run with yarn, while already worked(made with create-react-app).

I tried: yarn install - npm install --global yarn - npm update --global yarn - yarn version apply and ect.

when I run yarn start then:

enter image description here

Edit1: When I create a new project(with create-react-app), not occur any error. It gives an error only for the previous projects.

I already did yarn install for those directories, and yarn start worked. So run yarn install doesn't fix that. Although when I run run install again, it gives this error:

enter image description here

Edit2: When I remove node_modules and .yarn and yarn.lock, then run yarn install and thenyarn start, it gives another error:

enter image description here

like image 573
Arman Ebrahimi Avatar asked Sep 09 '25 19:09

Arman Ebrahimi


1 Answers

You should run

yarn install

before running any npm script (yarn start). It works when you use create-react-app because it installs dependencies by itself.

About the digital envelope error, You get this error because of the NodeJS version (most likely). If you use the latest LTS downgrade to the previous LTS version. You can read more here: Error message "error:0308010C:digital envelope routines::unsupported" Let me know how that goes –

like image 126
Tasos Avatar answered Sep 13 '25 09:09

Tasos