【问题标题】:NativeBase setup/installation errorNativeBase 设置/安装错误
【发布时间】:2018-12-12 11:55:51
【问题描述】:

我正在尝试使用official document 在我的 React-Native 项目中设置/安装 Native-Base。但是每次都会出错。

命令: npm install native-base --save

错误:

npm 错误!在“...yish/-/is-arrayish-0”附近解析时 JSON 输入意外结束。

npm 错误!可以在以下位置找到此运行的完整日志:

npm 错误! /home/abhijitsrivastava/.npm/_logs/2018-07-04T06_03_24_057Z-debug.log

系统规格:

node --version
v8.1.0

npm --version
6.0.0

react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4

Machine: Ubuntu 16.04LTS

IDE: Visual Studio Code Version 1.23.0

根据compatibility 矩阵,一切正常。不知道怎么解决。

更新:

这是我的 package.json 文件。

{
  "name": "xyz",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.3.1",
    "react-native": "^0.55.4",
    "react-navigation": "^2.3.1",
    "redux": "^4.0.0"
  },
  "devDependencies": {
    "babel-jest": "23.0.1",
    "babel-preset-react-native": "4.0.0",
    "jest": "23.1.0",
    "react-test-renderer": "16.3.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

【问题讨论】:

    标签: node.js react-native npm visual-studio-code native-base


    【解决方案1】:

    我在最近的一篇论坛帖子中注意到,他们建议使用 yarn 代替 npm 来安装依赖项和创建 React Native 应用程序。

    纱线: https://yarnpkg.com/en/docs/install#windows-stable

    安装yarn后尝试发出以下命令,

    yarn add native-base --save
    

    希望这会有所帮助!

    【讨论】:

    • 我有一个基于 npm 的正在运行的 react native 项目。我只是想为 UI 部分添加原生库。想要修复它是可能的。
    • 你能用你的package.json更新你的帖子吗?
    • 您可以尝试执行npm cache clean --force,然后再执行npm install,看看是否有效?
    【解决方案2】:

    在相同的线路上尝试过,没有问题

        {
        "name": "NativebaseKitchenSink",
        "version": "2.5.2",
        "private": true,
        "devDependencies": {
            "babel-eslint": "7.2.3",
            "eslint": "4.4.1",
            "eslint-plugin-flowtype": "2.35.0",
            "eslint-plugin-import": "2.7.0",
            "eslint-plugin-jsx-a11y": "6.0.2",
            "eslint-plugin-prettier": "2.1.2",
            "eslint-plugin-react": "7.1.0",
            "eslint-plugin-react-native": "3.0.1",
            "flow-bin": "0.52.0",
            "flow-typed": "2.1.5",
            "husky": "0.14.3",
            "jest": "20.0.4",
            "jest-expo": "25.0.0",
            "prettier": "1.5.3",
            "react-test-renderer": "16.3.1"
        },
        "scripts": {
            "start": "react-native start",
            "android": "react-native run-android",
            "ios": "react-native run-ios",
            "test": "node node_modules/jest/bin/jest.js --watch"
        },
        "jest": {
            "preset": "react-native"
        },
        "dependencies": {
            "color": "1.0.3",
            "lodash": "4.13.1",
            "moment": "2.13.0",
            "native-base": "^2.6.1",
            "react": "16.3.1",
            "react-native": "0.55.4",
            "react-navigation": "1.5.0"
        }
        }
    

    【讨论】:

      猜你喜欢
      • 2017-05-20
      • 1970-01-01
      • 1970-01-01
      • 2016-09-26
      • 2021-11-01
      • 1970-01-01
      • 2019-11-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多