React Native-安装React native Paper

时间:2019-04-04 00:56:33

标签: react-native build

我正在研究React Native项目,并试图将React Native论文添加到我的应用程序中。我的应用程序当前正在使用redux,但是当我尝试安装React Native Paper时,出现构建错误。我在Mac上运行iOS。

我已经按照React Native Paper网站上的步骤操作:https://callstack.github.io/react-native-paper/getting-started.html

  • 添加反应本机纸
  • 添加纱线react-native-vector-icons
  • 本机链接react-native-vector-icons

执行这些命令后,我的应用程序无法构建,并且显示“要求未知模块“ 1090”。如果确定该模块在那里,请尝试重新启动Metro Bundler。您可能还想运行yarnnpm install(取决于您的环境)。”

我已经尝试过清理yarn / npm缓存,看守员,并重新运行yarn / npm安装,但是还无法通过。

App.js(我删除了所有内容以尝试进行构建)-

import React from 'react';
import { View, Text } from 'react-native';
import { Provider } from 'react-redux';
import { Provider as PaperProvider } from 'react-native-paper';


    export default class App extends React.Component {
        render() {
            return (
                <PaperProvider>
                  <View>
                     <Text>Hello world</Text>
                  </View>
                </PaperProvider>
            );
        }
    }

这是终端中的消息:

GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 200 - "-" "native/1 CFNetwork/975.0.3 Darwin/18.2.0"
Error: ENOENT: no such file or directory, open '/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js'
    at Object.openSync (fs.js:448:3)
    at Object.readFileSync (fs.js:348:35)
    at Object.getSource (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Transformer.js:226:21)
    at getModuleSource (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:59:17)
    at getSourceMapInfo (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:50:42)
    at _toConsumableArray.concat.filter.filter.map.module (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/sourceMapObject.js:52:7)
    at Array.map (<anonymous>)
    at fullSourceMapObject (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/sourceMapObject.js:51:6)
    at /Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/Server.js:1165:14
    at Generator.next (<anonymous>)
::1 - - [04/Apr/2019:00:39:30 +0000] "POST /symbolicate HTTP/1.1" 500 - "-" "native/1 CFNetwork/975.0.3 Darwin/18.2.0"
Error: ENOENT: no such file or directory, open '/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js'
    at Object.openSync (fs.js:448:3)
    at Object.readFileSync (fs.js:348:35)
    at Object.getSource (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Transformer.js:226:21)
    at getModuleSource (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:59:17)
    at getSourceMapInfo (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js:50:42)
    at _toConsumableArray.concat.filter.filter.map.module (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/sourceMapObject.js:52:7)
    at Array.map (<anonymous>)
    at fullSourceMapObject (/Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/DeltaBundler/Serializers/sourceMapObject.js:51:6)
    at /Users/peyton/Desktop/Projects/MoviePass/native/node_modules/metro/src/Server.js:1165:14
    at Generator.next (<anonymous>)

在iPhone预览中:

Requiring unknown module "1090".If you are sure the module is there, try restarting Metro Bundler. You may also want to run `yarn`, or `npm install` (depending on your environment).


loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:224:31
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:170340:42
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:169329:37
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:163396:36
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:157171:40
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:157077:29
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:88467:38
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
<unknown>
    index.bundle?platform=ios&dev=true&minify=false:1367:48
loadModuleImplementation
    index.bundle?platform=ios&dev=true&minify=false:265:14
guardedLoadModule
    index.bundle?platform=ios&dev=true&minify=false:153:47
global code
    index.bundle?platform=ios&dev=true&minify=false:170659:4

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

也许您只需要将react-native-paper与您的react-native项目链接即可。因此,只需尝试使用此命令,它就可以解决您的问题。

<form id="cardUpload" method="post" enctype="multipart/form-data"> 
    <label>Card front image</label>
    <p><input type="file" accept="image/*" id="cardFront" name='image' /></p>
    <label>Card back image</label>
    <p><input type="file" accept="image/*" id="cardBack" name='image' /></p>
    <input type="submit" value="Add">
</form>