anil sidhu
anil sidhu

Reputation: 963

Unexpected use of reserved word 'import React-native

enter image description hereMy bable.src file code is here

 {
  "presets": ["es2015"]
}

Package.json file code is here

{
        "name": "Zoylo",
        "version": "0.0.1",
        "private": true,
        "scripts": {
            "start": "node node_modules/react-native/local-cli/cli.js start",
            "postinstall": "rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json",
            "test": "jest"
        },
        "dependencies": {
            "@ptomasroos/react-native-multi-slider": "0.0.11",
            "babel-core": "^6.26.0",
            "babel-loader": "^7.1.2",
            "jwt-node-decoder": "0.0.4",
            "npm": "^5.3.0",
            "prop-types": "^15.6.1",
            "react": "^16.2.0",
            "react-dom": "^16.3.2",
            "react-native": "^0.52.0",
        },
        "devDependencies": {
            "babel-eslint": "^8.0.3",
            "babel-jest": "20.0.3",
            "babel-plugin-transform-export-extensions": "^6.22.0",
            "babel-preset-env": "^1.6.1",
            "babel-preset-es2015": "^6.24.1",
            "babel-preset-react": "^6.24.1",
            "babel-preset-react-native": "^4.0.0",
            "babel-preset-stage-2": "^6.24.1",
            "jest": "20.0.4",
            "react-test-renderer": "16.0.0-alpha.12"
        },

    }

I think its a bable issue. Its working fine just 1 day ago and after npm install i am facing this issue.

Upvotes: 4

Views: 1198

Answers (1)

anil sidhu
anil sidhu

Reputation: 963

I got the answer. I had some problem in .babelrc file now here is my new .babelrc file

{ "env": { "test": { "presets": [ "env", "react", "es2015", "stage-2" ], "plugins": [ "transform-export-extensions" ], "only": [ "./**/*.js", "node_modules/jest-runtime" ] } }, "presets": [ "react-native" ] }

and need to run this command also.

watchman watch-del-all && rm -rf node_modules/ && npm cache clean --force && npm install && npm start -- --reset-cache 

Upvotes: 5

Related Questions