我一直在尝试使用本机脚本创建Angular代码共享项目。 这是我当前的系统规格:
本地脚本-版本
6.8.0-rc.4
Angular 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 g c [component-name]'时,出现以下错误:
An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name'
当存在“节点模块”文件夹并且存在@ schematics / angular / utility / parse-name(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
在此先感谢您的帮助。我真的很感激!
答案 0 :(得分:0)
这对我有用。
npm i --save-dev @nativescript/schematics