Npm set up reaction-native cleanup in node_modules

I am encountering a problem when trying to use npm installto install reduxin my project react-native. Every time I run npm install redux --save, the directory react-nativeinside node_moduleswill be cleared.

Then I use rm -rf node_modules && npm install, the package is react-nativenot installed inside node_modules, so I have to recreate the project.

I also try to copy and past react-reduxand reduxin node_modulesfrom another project in my current project react-native. But this cannot be successful, the error will lead me to issue on github. I have been following this help and it also fails.

Other information:

➜ npm: 5.0.3

➜ response-native-cli: 2.0.1

➜ reaction-native: 0.45.0

➜ package.json

{
    "name": "MyProjectNAME",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "react": "16.0.0-alpha.12",
        "react-native": "0.45.0",
        "react-redux": "^5.0.5",
        "redux": "^3.6.0"
    },
    "devDependencies": {
        "babel-cli": "^6.24.1",
        "babel-jest": "20.0.3",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-es2017": "^6.24.1",
        "babel-preset-react-native": "1.9.2",
        "jest": "20.0.4",
        "react-test-renderer": "16.0.0-alpha.12"
    },
    "jest": {
        "preset": "react-native"
    }
}

.

+3
2

, , , , , rem-native npm install redux --save.

:

  • -lock.json ( , )
  • rm -rf node_modules && npm install
  • / node_modules -native
  • npm install redux (npm v5 - ) .

package-lock.json?

npm v5, . package-lock.json(lockfile) , npm / node_modules package.json.

-lock.json , npm install (v5), node_modules, . , .

npm install somePackageName - , .json?

- , node npm v5. npm v5 (, npm install redux), :

  • package-lock.json ( , ). Redux .
  • package.json node , npm v5 ( _, , _from, _requiredBy, _resolved ..).
  • , , v5, - . json lock.json.

, rm -rf node_modules && npm install - package-lock.json(, ? -lock.json)

, - .

+7

, :

1)

2) node_modules 1 react-native.

. .

0

All Articles