daff laff
daff laff

Reputation: 29

Accidentally deleted node_modules folder

I accidentally deleted my node_modules folder. I know the way to get it back is just to run npm install but this won't work in my case. It's saying something's wrong in my JSON file. I'm getting this error in Terminal.

Here's my Package.js file:

{
  "name": "App",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "aws-sdk": "git://github.com/aws/aws-sdk-js.git#react-native",
    "react": "^16.0.0-alpha.12",
    "react-native": "^0.45.1",
    "react-native-aws-signature": "0.0.9",
    "react-native-dropdown-menu": "^1.1.0",
    "react-native-dynamodb": "0.0.5",
    "react-redux": "^5.0.5",
    "redux": "^3.7.1"
  },
  "devDependencies": {
    "babel-jest": "20.0.3",
    "babel-preset-react-native": "2.0.0",
    "jest": "20.0.4",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "jest": {
    "preset": "react-native"
  },
}

Error:

Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:

Upvotes: 1

Views: 4154

Answers (3)

JamesD
JamesD

Reputation: 611

run this json through a json validator online. e.g. https://jsonlint.com/

The previous answer was right but this should help you in the future.

Upvotes: 0

Kukic Vladimir
Kukic Vladimir

Reputation: 1010

There is an error on line 27, sufficient , here is a valid json

{
    "name": "TorusTApp",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "aws-sdk": "git://github.com/aws/aws-sdk-js.git#react-native",
        "react": "^16.0.0-alpha.12",
        "react-native": "^0.45.1",
        "react-native-aws-signature": "0.0.9",
        "react-native-dropdown-menu": "^1.1.0",
        "react-native-dynamodb": "0.0.5",
        "react-redux": "^5.0.5",
        "redux": "^3.7.1"
    },
    "devDependencies": {
        "babel-jest": "20.0.3",
        "babel-preset-react-native": "2.0.0",
        "jest": "20.0.4",
        "react-test-renderer": "16.0.0-alpha.12"
    },
    "jest": {
        "preset": "react-native"
    }
}

Upvotes: 3

user3137367
user3137367

Reputation:

I believe it is because you have an extra comma on the next to last line in your package.js file.

Upvotes: 1

Related Questions