首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >本机脚本Angular代码共享项目不创建节点模块目录,无法创建组件

本机脚本Angular代码共享项目不创建节点模块目录,无法创建组件
EN

Stack Overflow用户
提问于 2020-08-02 21:52:48
回答 1查看 736关注 0票数 2

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

原生脚本-version

6.8.0-rc.4

Angular CLI: 10.0.2

节点: 10.22.0

操作系统: darwin x6

@nativescript/schematics@10.0.2

当我运行tns doctor时:

Jasons-MacBook-Pro:台式机所有者$ tns医生

代码语言:javascript
复制
✔ 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.

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

代码语言:javascript
复制
ng new --collection=@nativescript/schematics project-name --shared

项目成功创建,但控制台返回以下内容:

代码语言:javascript
复制
⠴ 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 component-name‘时,我得到以下错误:

代码语言:javascript
复制
An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name' 

当有一个'node modules‘文件夹并且有一个@schematics/angular/utility/parse-name (ts和d.ts)存在时,我也会得到这个错误。

我已经参考并尝试了许多在线线程来纠正这一点,坦率地说,我已经把我大脑中的本地脚本部分弄得乱七八糟。

我引用并尝试过的资源:

代码语言:javascript
复制
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

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

EN

回答 1

Stack Overflow用户

发布于 2020-08-03 03:56:29

这对我很有效。

代码语言:javascript
复制
npm i --save-dev @nativescript/schematics
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63216795

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档