无法创建 Angular 本机共享应用程序
Unable to Create Angular Native Shared Application
我正在按照 https://docs.nativescript.org/angular/tooling/angular-cli#installation 文档创建 NativaScript + Angular 共享应用程序
我做了以下事情
npm i -g @angular/cli
npm i -g @nativescript/schematics
然后从合适的文件夹
ng new --collection=@nativescript/schematics my-mobile-app --shared --sample --prefix=my --style=scss
终于登陆到如下错误
*npm 错误!代码 ETARGET
错误! notarget 未找到与@angular/http@~9.1.0 匹配的版本。
错误! notarget 在大多数情况下,您或您的依赖项之一正在请求
错误! notarget 一个不存在的包版本。
错误!没有目标
错误! notarget 它被指定为 'my-mobile-app' 的依赖项
错误! notarget
npm 错误!此 运行 的完整日志可在以下位置找到:
错误! C:\Users\username\AppData\Roaming\npm-cache_logs20-07-15T18_27_24_869Z-debug.log
× 包安装失败,见上文。
示意图工作流失败。见上文。*
一些 body 可以帮助。
我尝试了多个 angular 版本
@angular/cli V 8.x, 9.x, 10.x
@nativescript/schematic@9
看来 @nativescript/schematics 的发布版本有问题。
https://github.com/NativeScript/nativescript-schematics/issues/283
里面有关于如何下载最新原理图的说明。
之后,我运行进入以下错误:
Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
- options[1] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
- options[2] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
已通过执行以下内容中的说明修复了该问题:
从而导致项目构建成功,然后
Webpack build done!
Project successfully prepared (android)
Successfully transferred package.json on device emulator-5554.
Successfully transferred runtime.js on device emulator-5554.
Successfully transferred tns-java-classes.js on device emulator-5554.
Restarting application on device emulator-5554...
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Cannot compile /data/data/org.nativescript.test/files/app/bundle.js
System.err: SyntaxError: Unexpected identifier
System.err: File: (file:///data/data/org.nativescript.test/files/app/bundle.js:34:144)
从那里我被困住了...
我已经尝试禁用 IVY 和 运行 常春藤,如讨论的那样 https://github.com/NativeScript/nativescript-angular/wiki/Updating-and-developing-for-@nativescript-angular-v9-with-Ivy-or-without,但没有成功。
我正在按照 https://docs.nativescript.org/angular/tooling/angular-cli#installation 文档创建 NativaScript + Angular 共享应用程序
我做了以下事情
npm i -g @angular/cli
npm i -g @nativescript/schematics
然后从合适的文件夹
ng new --collection=@nativescript/schematics my-mobile-app --shared --sample --prefix=my --style=scss
终于登陆到如下错误
*npm 错误!代码 ETARGET 错误! notarget 未找到与@angular/http@~9.1.0 匹配的版本。 错误! notarget 在大多数情况下,您或您的依赖项之一正在请求 错误! notarget 一个不存在的包版本。 错误!没有目标 错误! notarget 它被指定为 'my-mobile-app' 的依赖项 错误! notarget
npm 错误!此 运行 的完整日志可在以下位置找到: 错误! C:\Users\username\AppData\Roaming\npm-cache_logs20-07-15T18_27_24_869Z-debug.log × 包安装失败,见上文。 示意图工作流失败。见上文。*
一些 body 可以帮助。 我尝试了多个 angular 版本 @angular/cli V 8.x, 9.x, 10.x @nativescript/schematic@9
看来 @nativescript/schematics 的发布版本有问题。
https://github.com/NativeScript/nativescript-schematics/issues/283
里面有关于如何下载最新原理图的说明。
之后,我运行进入以下错误:
Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
- options[0] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
- options[1] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
- options[2] misses the property 'patterns'. Should be:
[non-empty string | object { from, to?, context?, globOptions?, toType?, force?, flatten?, transform?, cacheTransform?, transformPath?, noErrorOnMissing? }, ...] (should not have fewer than 1 item)
ValidationError: Invalid options object. Copy Plugin has been initialized using an options object that does not match the API schema.
已通过执行以下内容中的说明修复了该问题:
从而导致项目构建成功,然后
Webpack build done!
Project successfully prepared (android)
Successfully transferred package.json on device emulator-5554.
Successfully transferred runtime.js on device emulator-5554.
Successfully transferred tns-java-classes.js on device emulator-5554.
Restarting application on device emulator-5554...
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Cannot compile /data/data/org.nativescript.test/files/app/bundle.js
System.err: SyntaxError: Unexpected identifier
System.err: File: (file:///data/data/org.nativescript.test/files/app/bundle.js:34:144)
从那里我被困住了...
我已经尝试禁用 IVY 和 运行 常春藤,如讨论的那样 https://github.com/NativeScript/nativescript-angular/wiki/Updating-and-developing-for-@nativescript-angular-v9-with-Ivy-or-without,但没有成功。