我尝试使用
npx create-react-native-library qrscanlib
创建 React 本机库。
在输入作者姓名和存储库等所有配置后,我收到以下错误,
✔ Which languages do you want to use? › Java & Objective-C
⠧ Generating example app
⚠️ The `init` command is deprecated.
The behavior will be changed on 12/31/2024 (82 days).
- Switch to npx @react-native-community/cli init for the identical behavior.
- Refer to the documentation for information about alternative tools: https://reactnative.dev/docs/getting-started
Running: npx @react-native-community/cli init
error Invalid Version: latest.
/Users/rj/.npm/_npx/7655a6858458ff34/node_modules/create-react-native-library/lib/utils/spawn.js:27
reject(new Error(stderr.trim()));
^
Error: ⚠️ The `init` command is deprecated.
The behavior will be changed on 12/31/2024 (82 days).
- Switch to npx @react-native-community/cli init for the identical behavior.
- Refer to the documentation for information about alternative tools: https://reactnative.dev/docs/getting-started
Running: npx @react-native-community/cli init
error Invalid Version: latest.
at ChildProcess.<anonymous> (/Users/rj/.npm/_npx/7655a6858458ff34/node_modules/create-react-native-library/lib/utils/spawn.js:27:16)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at ChildProcess._handle.onexit (node:internal/child_process:302:5)
根据错误,此命令
npx create-react-native-library qrscanlib
将在 82 天后过期,但此时它必须起作用。 React Native 文档或 create-react-native-library 文档未提及此错误或未来的升级或任何替代方案。
上述错误的任何解决方案或任何解决方法或使用 npx 创建反应本机库的任何替代方法?
注意:请不要向任何人推荐使用 React Native bob builder。
我找到了创建库的解决方法命令,
npx create-react-native-library@latest qrscanlib --reactNativeVersion 0.74.2