Search code examples
jsonshellreact-nativevisual-studio-app-center

'[Error] Unable to find or read "package.json" in the CWD. The "release-react" command must be executed in a React Native project folder.'


I've been getting this error while trying to create a script file to automate a little of the codePush deployment process.

Looking at all the information I could find online wasn't helping - In the script I echo'd the PWD to see that I am running the code-push release-react command from the correct location in my .sh file, I am including react-native as a package dependency in my package.json. Everything looked fine, but I was still getting the error.

Since I found the issue but couldn't find anything online to point to what the problem was, I'll post the answer below.


Solution

  • Upon playing with the scripts in my package.json I tried running npm install again to make sure everything was setup properly when I get an error that actually showed me my issue.

    The problem was the JSON in my package.json had become corrupted - the syntax wasn't spot on. I had started playing with the json in the file and forgot to revert the changes I made when I finished and had an extra comma.

    Now that almost a whole day is gone, I can get back to work.