2

我一直在尝试使用 Native Script 创建一个 Angular 代码共享项目。这是我当前的系统规格:

本机脚本版本

6.8.0-rc.4

角 CLI:10.0.2

节点:10.22.0

操作系统:达尔文 x6

@nativescript/schematics@10.0.2

当我运行 tns 医生时:

Jasons-MacBook-Pro:桌面所有者$ tns 医生

✔ 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.0.0 satisfies minimum required version 10.

✔ Getting NativeScript components versions information...

⚠ Update available for component nativescript. Your current version is 6.8.0-rc.4 and the latest available version is 6.8.0.

要初始化项目,我运行以下命令:

ng new --collection=@nativescript/schematics project-name --shared

项目成功创建,但控制台返回:

⠴ Installing packages...npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

npm WARN deprecated request@2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated

npm WARN deprecated har-validator@5.1.5: this library is no longer supported

npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

npm ERR! code ETARGET

npm ERR! notarget No matching version found for @angular/http@~9.1.0.

npm ERR! notarget In most cases you or one of your dependencies are requesting

npm ERR! notarget a package version that doesn't exist.

npm ERR! notarget 

npm ERR! notarget It was specified as a dependency of 'project-name'

npm ERR! notarget 



npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/owner/.npm/_logs/2020-08-02T02_31_24_911Z-debug.log

✖ Package install failed, see above.

The Schematic workflow failed. See above.

Owners-MacBook-Pro:Desktop owner$ 

在文档中,我看到了这条注释:注意:如果上述命令不起作用,请检查您的主目录 (/home/user-name/.angular.json) 中是否没有无效的配置文件。请删除该文件并再次运行该命令。

但我不确定这是否适用于我的情况,如果适用,我不确定在哪里可以找到这个文件。如果项目没有创建,这个文件在我系统的某个地方吗?

注意:运行此命令时,项目永远不会带有“节点模块”文件夹。这是有道理的,因为当我运行 'ng gc [component-name] ' 时,我收到以下错误:

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name' 

当存在“节点模块”文件夹并且存在 @schemics/angular/utility/parse-name(ts 和 d.ts)时,我也会收到此错误。

我已经参考并尝试了许多在线线程来纠正这个问题,坦率地说,我已经把我大脑的 Native Script 部分缠绕成一团毛线。

我参考并尝试过的资源:

https://docs.nativescript.org/angular/code-sharing/creating-a-new-project
https://github.com/NativeScript/nativescript-schematics/pull/286
https://github.com/NativeScript/nativescript-schematics/issues/241

预先感谢您的帮助。对此,我真的非常感激!

4

1 回答 1

0

这对我有用。

npm i --save-dev @nativescript/schematics
于 2020-08-02T19:56:29.187 回答