-->

npm-shrinkwrap.json: Could not install from \"node

2019-08-23 07:36发布

问题:

I tried to run an npm install this morning on a React Native 0.53.3 project with "react-navigation": "1.5.11", and I got this error:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules/react-navigation/react-native-tab-view@github:react-navigation/react-native-tab-view#36ebd834d78b841fc19778c966465d02fd1213bb" as it does not contain a package.json file.

I thought it would resolve by adding this to my package.json file:

"react-native-tab-view": "^1.3.2",

but I continue to get that same error. I opened a couple of issues with react-navigation team and it got closed as they concluded it is a problem with npm.

Has anyone run into this issue? How can I resolve this as its keeping me from running npm install and getting the project up and running.

It looks like it is referencing this inside of npm-shrinkwrap.json:

"react-native-tab-view": {
      "version": "github:react-navigation/react-native-tab-view#36ebd834d78b841fc19778c966465d02fd1213bb",
      "from": "react-native-tab-view@github:react-navigation/react-native-tab-view#36ebd834d78b841fc19778c966465d02fd1213bb",
      "requires": {
        "prop-types": "^15.6.0"
      }
    },

回答1:

This seems to be an issue with npm-shrinkwrap.json where the error kept referencing the following inside of it:

"react-native-tab-view": {
      "version": "github:react-navigation/react-native-tab-view#36ebd834d78b841fc19778c966465d02fd1213bb",
      "from": "react-native-tab-view@github:react-navigation/react-native-tab-view#36ebd834d78b841fc19778c966465d02fd1213bb",
      "requires": {
        "prop-types": "^15.6.0"
      }
    },

Removing just this did not help, I had to completely remove npm-shrinkwrap.json and do an npm install with just the conventional package-lock.json.