node.js - NativeBase 设置/安装错误

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

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

命令: npm install native-base --save

错误:

npm ERR! Unexpected end of JSON input while parsing near '...yish/-/is-arrayish-0.'

npm ERR! A complete log of this run can be found in:

npm ERR! /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"
  }
}

最佳答案

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

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

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

yarn add native-base --save

希望这有帮助!

关于node.js - NativeBase 设置/安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51166930/

相关文章:

react-native - 版本 1.5.1 nxworkspace + React Native 的 Axios url 未定义问题

node.js - express.static 处理根 url 请求

node.js - Firebase 的云功能 - 已验证电子邮件操作

ios - 解压速度太慢

android - 底部导航图标在 Android 和 iOS 中显示为正方形

node.js - 仅需要一个模块(如果已安装)

javascript - 值得麻烦地提交 package-lock.json 吗?

node.js ipfs-api 添加和读取文件

javascript - MongoDB 将 [{k1 :v1}, {k2:v2}] 转换为 {v1: v2}

android - 如何修复 React Native 最新版本(0.59)中的 'No connected devices!'?