我正在尝试使用react-nativecli 创建新项目,但是当我创建一个新项目时,我收到以下错误消息:
react-native> create-react-class> fbjs> core-js@1.2.7:不再维护core-js @ <2.6.8。请升级到core-js @ 3或至少升级到实际版本的core-js @ 2。
下面列出的是我package.json文件的内容:
{
"name": "EmojiDictRN",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.8.3",
"react-native": "0.59.8"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/runtime": "^7.4.5",
"babel-jest": "^24.8.0",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.54.1",
"react-test-renderer": "16.8.3"
},
"jest": {
"preset": "react-native"
}
}
Run Code Online (Sandbox Code Playgroud)
要查看我的终端的完整输出,请单击此处。关于如何解决此警告消息的任何想法?
任何帮助将不胜感激!
我尝试使用 cli 构建我的 React Native 应用程序,并出现此错误日志。Xcode 构建稳定,没有发生错误。
这是日志的一部分:
2 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
While building module 'Darwin' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:
In file included from <module-includes>:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stdatomic.h:24:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include/stddef.h:102:10: fatal error: could not build module '_Builtin_stddef_max_align_t'
#include "__stddef_max_align_t.h"
~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.
While building module 'Foundation' imported from /Users/omerkocer/tekvetek/ios/Pods/Target Support Files/Pods-tekvetek_RN-OneSignalNotificationServiceExtension/Pods-tekvetek_RN-OneSignalNotificationServiceExtension-dummy.m:1:
While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
In file included from <module-includes>:1:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: …Run Code Online (Sandbox Code Playgroud) 当我跑步react-native start或npm start打包机启动并提示时Looking for JS files in /Users/map/repos/myrepo/
我已经启用了热重装.当我更改位于其中的文件/Users/map/repos/myrepo/node_modules/react-native/似乎检测到更改时,但是如果我在第三方存储库中编辑文件,就像/Users/map/repos/myrepo/node_modules/react-native-menu/看起来像watchman没有检测到更改.
我刚刚将项目中的React Native升级到0.39,我认为这不是之前的默认行为.我已经设置了一些登录react-packager/src/node-haste/index.js,似乎react-native-menu包含了文件hasteFSFiles,但change事件未被触发.
我已经尝试删除node_modules并重新安装它,清理守望者状态和其他没有运气.
有没有一种方法可以使用命令运行特定目标
react-native run-ios
Run Code Online (Sandbox Code Playgroud)
对于Android,我正在使用以下
react-native run-android --variant=targetRelease
Run Code Online (Sandbox Code Playgroud) 我使用初始化应用程序时收到以下语法错误 react-native init MyApp
SyntaxError: /Users/MyAccount/RNProjects/app/node_modules/react-native/packager/react-packager/src/node-haste/index.js: You can only use Class Properties when the 'classProperties' plugin is enabled. (389:2)
387 | }
388 |
> 389 | static Cache;
| ^
390 | static Module;
391 | static Polyfill;
392 | static getAssetDataFromName;
at Parser.pp$5.raise (/Users/MyAccount/RNProjects/app/node_modules/babylon/lib/index.js:4380:13)
Run Code Online (Sandbox Code Playgroud)
我不知道为什么会突然发生这种情况.之前一切正常.我想我在修补时错误地删除了一些配置文件.
我正在尝试react-native-cli使用以下命令进行安装:
C:\WINDOWS\System32>npm install -g react-native -cli
Run Code Online (Sandbox Code Playgroud)
我收到以下错误,有人可以帮忙解决这个问题吗?
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\react-native -> D:\Programming\React.js\ProgrammingReact.jsnode_modules\node_modules\node_modules\react-native\local-cli\wrong-react-native.js
npm WARN react-native@0.54.0 requires a peer of react@^16.3.0-alpha.1 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-check-constants@7.0.0-beta.38 requires a peer of @babel/core@7.0.0-beta.38 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\react-native\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for …Run Code Online (Sandbox Code Playgroud) 检查当前的 React Native CLI 版本
react-native -v
react-native-cli: 1.0.0
react-native: 0.61.5
Run Code Online (Sandbox Code Playgroud)
我使用以下命令来升级全局react-native-cli版本
npm uninstall -g react-native-cli
npm install -g react-native-cli
Run Code Online (Sandbox Code Playgroud)
但现在检查当前的 React Native cli 版本,它仍然是v1.0.0
react-native -v
react-native-cli: 1.0.0
react-native: 0.61.5
Run Code Online (Sandbox Code Playgroud)
如何升级react-native-cli?
根据react-native cli 文档,我们可以根据每个平台为 RN cli 指定自定义配置。我想更改每个平台文件夹的默认位置,所以我将我的自定义添加react-native.config.js到项目的根目录,您可以在这里找到:
module.exports = {
project: {
ios: {
project: './example/ios/example.xcworkspace',
},
android: {
sourceDir: './example/android/',
},
},
};
Run Code Online (Sandbox Code Playgroud)
如果我react-native config在根文件夹中运行,可以看到正确的配置:
{
...
"project": {
"ios": {
"sourceDir": "path-to-project-directory/example/ios",
"folder": "path-to-project-directory",
"pbxprojPath": "path-to-project-directory/example/ios/example.xcworkspace/project.pbxproj",
"podfile": "path-to-project-directory/example/ios/Podfile",
"podspecPath": null,
"projectPath": "path-to-project-directory/example/ios/example.xcworkspace",
"projectName": "example.xcworkspace",
"libraryFolder": "Libraries",
"sharedLibraries": [],
"plist": [],
"scriptPhases": []
},
"android": {
"sourceDir": "path-to-project-directory/example/android/",
"isFlat": true,
"folder": "path-to-project-directory",
"stringsPath": "path-to-project-directory/example/android/app/src/main/res/values/strings.xml",
"manifestPath": "path-to-project-directory/example/android/app/src/main/AndroidManifest.xml",
"buildGradlePath": "path-to-project-directory/example/android/build.gradle",
"settingsGradlePath": "path-to-project-directory/example/android/settings.gradle",
"assetsPath": "path-to-project-directory/example/android/app/src/main/assets",
"mainFilePath": "path-to-project-directory/example/android/app/src/main/java/com/example/MainApplication.java", …Run Code Online (Sandbox Code Playgroud) 我刚刚更新到 RN v0.63.3。react-native run-ios更改应用程序名称后,我在以前的反应本机版本上遇到了问题,并且项目/方案有不同的名称,从未解决该问题,每个人都说只需升级即可。
现在在 v0.63.3 上仍然存在构建失败的问题react-native run-ios。这次的错误是:
** 构建失败 **
以下构建命令失败:CompileC /Users/vorousjames/Library/Developer/Xcode/DerivedData/<OLD_NAME>-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/<NEW_NAME>.build/Debug-iphonesimulator/<NEW_NAME>.build/Objects- Normal/x86_64/AppDelegate.o /Users/Desktop/Development/App/iOS/<OLD_NAME>/AppDelegate.m 正常 x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 次失败)
从 Xcode 内部构建/运行没有问题。只有react-native run-ios
编辑:我想也许是因为我在全局安装了 cli,因为我只是调用react-native run-ios. 我相信使用全局安装。因此,由于它已经过时,我全局卸载并尝试将社区包与npx react-native run-ios. 现在它给出了另一个 comileC 错误,但有所不同。
** 构建失败 **
以下构建命令失败:CompileC /Users/Library/Developer/Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseMessaging.o /用户/桌面/开发/应用程序/node_modules/react-native-firebase/ios/RNFirebase/messaging/RNFirebaseMessaging.m正常x86_64目标-c com.apple.compilers.llvm.clang.1_0.compiler CompileC /Users/Library/Developer /Xcode/DerivedData/App-gdmnlxiprekjqhfiueouiidqhqnl/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNFirebase.build/Objects-normal/x86_64/RNFirebaseFirestore.o /Users/Desktop/Development/App/node_modules/react-native -firebase/ios/RNFirebase/firestore/RNFirebaseFirestore.m 正常 x86_64 Objective-c com.apple.compilers.llvm.clang.1_0.compiler (2 次失败)
这完全扼杀了我快速迭代的能力,欢迎任何建议
反应原生:0.63.3 反应原生-cli(全局):2.0.1 反应原生社区/cli:^4.8.0 Xcode:12.0.1 iOS:14.0.1
更新:
包.json:
{
"name": "Aflare",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native …Run Code Online (Sandbox Code Playgroud) 我正在使用react-native-cli,在我的应用程序中,react-native-video 在我的页面中不起作用。它显示空白区域。我已经运行react-native link命令来链接库,并且在运行react-native run-android命令后但显示空白,没有任何错误。我正在使用react-native v 0.48.4 任何帮助表示赞赏!
import React, { Component } from 'react';
import { StyleSheet, Text, View, ScrollView,Image, Dimensions,Alert } from 'react-native';
import Video from 'react-native-video';
export default class HomeScreen extends Component {
constructor(props) {
super(props);
this.loadStart = this.loadStart.bind(this);
this.onLoad = this.onLoad.bind(this);
this.onProgress = this.onProgress.bind(this);
this.onEnd = this.onEnd.bind(this);
this.onError = this.onError.bind(this);
this.onBuffer = this.onBuffer.bind(this);
this.onTimedMetadata = this.onTimedMetadata.bind(this);
};
loadStart(){
console.log('loadStart');
}
onLoad(){
console.log('onLoad');
}
onProgress(){
console.log('onProgress');
}
onEnd(){
console.log('onEnd');
}
onError(){
console.log('onError'); …Run Code Online (Sandbox Code Playgroud) react-native ×10
react-native-cli ×10
ios ×2
android ×1
cocoapods ×1
javascript ×1
npm ×1
reactjs ×1
watchman ×1
xcode ×1