0

Currently using react-native-cli: 1.0.0 and react-native: 0.26.3

Running react-native command in terminal gives this error.

/Users/appleuser/Desktop/asklegit-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229 throw err; ^ SyntaxError: /Users/appleuser/package.json: Error while parsing JSON - Unexpected end of input at Object.parse (native) at OptionManager.addConfig (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:225:62) at OptionManager.findConfigs (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:442:30) at OptionManager.init (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-core/lib/transformation/file/options/option-manager.js:484:12) at compile (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-register/lib/node.js:112:69) at loader (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-register/lib/node.js:158:14) at Object.require.extensions.(anonymous function) [as .js] (/Users/appleuser/Desktop/asklegit-app/node_modules/babel-register/lib/node.js:168:7) at Module.load (module.js:357:32) at Function.Module._load (module.js:314:12) at Module.require (module.js:367:17)

Anyone got a clue? Couldn't find anything online :(

This is my package.json

{
  "name": "asklegit",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "ios": "react-native run-ios",
    "android": "react-native run-android"
  },
  "dependencies": {
    "react": "15.0.2",
    "react-native": "0.26.3"
  }
}
5
  • 1
    post your package.json please Commented Jun 13, 2016 at 19:34
  • @KRONWALLED that is my app's package.json but why is the error coming from my global package.json Commented Jun 13, 2016 at 19:41
  • I think there is a empty package.json at /Users/appleuser/package.json. Could you look into it and if it is empty delete it? Commented Jun 13, 2016 at 19:52
  • @KRONWALLED Sweet! Thank you that worked! Commented Jun 13, 2016 at 19:53
  • @KRONWALLED nice catch , you should post it as an answer Commented Jun 13, 2016 at 20:21

1 Answer 1

1

I don't know under which circumstances but it seems sometimes there is an empty package.json created in the users home directory. A completely empty file is by default not correct syntax so calling applications will produce an error.

Solution is to just delete the empty package.json.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.