我正在处理本机项目,我已经安装了@react-native-community/datetimepicker 通过这两个命令:
npm install @react-native-community/datetimepicker --save
还有:
npx react-native link @react-native-community/datetimepicker
当我运行应用程序时,我发现了错误,所以我运行了 ./gradlew clean 我发现了这个错误:
PS D:\test 2\Smart Roster\android> ./gradlew clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':@react-native-community_datetimepicker'.
> Could not create service of type ScriptHandlerInternal using ProjectScopeServices.createScriptHandler().
> Could not create service of type DependencyLockingProvider using DependencyResolutionScopeServices.createDependencyLockingProvider().
> Illegal char <:> at index 32: D:\test 2\Smart Roster\android\C:\Users\lenovo\AppData\Roaming\npm\node_modules\@react-native-community\datetimepicker\android\gradle\dependency-locks
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
答案 0 :(得分:1)
如 npmjs 中所述,对于版本 >=0.60 的链接只需调用:
npx pod-install
然后重建您的项目。
如果您在 MacO 上工作,则可以这样做。
如果你在 Windows 上工作,npmjs 说:
<块引用>Windows 还没有实现自动链接,所以手动安装 需要。
因此,请按照 this 链接 Windows 上的库
当向导说 Right-click solution icon in Solution Explorer > Add > Existing Project Select
时,您应该进入 Solution Explorer
选项卡,右键单击 Solution
图标,然后选择 Add -> Existing Project...
。看下图:
Here 引用。