无法编译本机反应

时间:2021-03-05 08:06:34

标签: javascript react-native metro-bundler

所以我一直在尝试运行我的 React Native 代码,但它不断出现不同的错误。我已经设法从网上找到的解决方案中解决了这些问题,但我似乎找不到这个特定的问题。

当我运行 react-native run-android 时出现此错误

Failed to compile.
C:/Users/Stephen Murya/Desktop/dev/react-native/FaceAttendance/node_modules/react-native/Libraries/Components/UnimplementedViews/UnimplementedView.js
Module not found: Can't resolve 'StyleSheet' in 'C:\Users\Stephen Murya\Desktop\dev\react-native\FaceAttendance\node_modules\react-native\Libraries\Components\UnimplementedViews'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Error from chokidar (C:\node_modules): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp' 

这是UnimplementedViews中js文件的内容

/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow strict-local
 * @format
 */
'use strict';

const React = require('React');
const StyleSheet = require('StyleSheet');

/**
 * Common implementation for a simple stubbed view. Simply applies the view's styles to the inner
 * View component and renders its children.
 */
class UnimplementedView extends React.Component<$FlowFixMeProps> {
  setNativeProps() {
    // Do nothing.
    // This method is required in order to use this view as a Touchable* child.
    // See ensureComponentIsNative.js for more info
  }

  render() {
    // Workaround require cycle from requireNativeComponent
    const View = require('View');
    return (
      <View style={[styles.unimplementedView, this.props.style]}>
        {this.props.children}
      </View>
    );
  }
}

const styles = StyleSheet.create({
  unimplementedView: __DEV__
    ? {
        alignSelf: 'flex-start',
        borderColor: 'red',
        borderWidth: 1,
      }
    : {},
});

module.exports = UnimplementedView;

我不知道这里似乎有什么问题

0 个答案:

没有答案