我正在开发一个需要转换为原生 Android 代码的 Nativescript 项目。我没有多少 Nativescript 经验,所以我正在做一个关于“代码共享”的教程。
https://docs.nativescript.org/code-sharing/creating-a-new-project
我已经完成了设置并安装了所有依赖项。我可以通过以下方式确认tns doctor
:
✔ Getting environment information
No issues were detected.
✔ Your ANDROID_HOME environment variable is set and points to correct directory.
✔ Your adb from the Android SDK is correctly installed.
✔ The Android SDK is installed.
✔ A compatible Android SDK for compilation is found.
✔ Javac is installed and is configured properly.
✔ The Java Development Kit (JDK) is installed and is configured properly.
✔ Xcode is installed and is configured properly.
✔ xcodeproj is installed and is configured properly.
✔ CocoaPods are installed.
✔ CocoaPods update is not required.
✔ CocoaPods are configured properly.
✔ Your current CocoaPods version is newer than 1.0.0.
✔ Python installed and configured correctly.
✔ The Python 'six' package is found.
✔ Xcode version 12.4.0 satisfies minimum required version 10.
✔ Getting NativeScript components versions information...
✔ Component nativescript has 7.2.1 version and is up to date.
然后我运行了两个提到的命令:
$ npm i -g @nativescript/schematics
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: typescript@4.2.3
npm WARN node_modules/@nativescript/schematics/node_modules/typescript
npm WARN peer typescript@">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev" from tslint@5.20.1
npm WARN node_modules/@nativescript/schematics/node_modules/tslint
npm WARN peer tslint@"^5.16.0" from @nativescript/tslint-rules@0.0.5
npm WARN node_modules/@nativescript/schematics/node_modules/@nativescript/tslint-rules
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer typescript@"^3.4.0" from @nativescript/tslint-rules@0.0.5
npm WARN node_modules/@nativescript/schematics/node_modules/@nativescript/tslint-rules
npm WARN @nativescript/tslint-rules@"~0.0.5" from @nativescript/schematics@11.0.0
npm WARN node_modules/@nativescript/schematics
changed 88 packages in 11s
12 packages are looking for funding
run `npm fund` for details
然后是第二个,但问题似乎已经在第一个命令中:
$ ng new --collection=@nativescript/schematics hello-world --shared
⠏ Installing packages (npm)...npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hello-world@0.0.0
npm ERR! Found: tslint@6.1.3
npm ERR! node_modules/tslint
npm ERR! dev tslint@"~6.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer tslint@"^5.16.0" from @nativescript/tslint-rules@0.0.5
npm ERR! node_modules/@nativescript/tslint-rules
npm ERR! dev @nativescript/tslint-rules@"~0.0.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/jclermonts/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jclermonts/.npm/_logs/2021-03-27T16_45_09_004Z-debug.log
✖ Package install failed, see above.
The Schematic workflow failed. See above.
任何帮助将不胜感激。
- 这个问题似乎是一样的。我也试过
--force
了--legacy-peer-deps
- 按照这个线程中的建议降级节点我可以尝试作为最后的手段,但问题没有回答我应该降级到哪个特定版本。