Native Script Angular代码共享项目不创建节点模块目录,也无法创建组件



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

nativescript-版本

6.8.0-rc.4

Angular CLI:10.0.2

节点:10.22.0

操作系统:达尔文x6

@本地描述/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(。请删除该文件,然后再次运行该命令。

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

注意:运行此命令时,项目从不附带"node-modules"文件夹。这是有道理的,因为当我运行"ng g c[组件名称]"时,我会得到以下错误:

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

当有一个"节点模块"文件夹,并且存在@schemicals/angular/putility/parse名称(ts和d.ts(时,我也会收到这个错误。

我参考并尝试了许多在线帖子来纠正这一点,坦率地说,我把我大脑中的土著脚本部分弄得一团糟。

我参考并尝试过的资源:

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

提前感谢您的帮助。我真的很感激!

这对我有效。

npm i --save-dev @nativescript/schematics

最新更新