今天,我将我的角度cli更新为最新版本,并遇到一个错误,阻止我创建一个新的Angular项目.以下是执行后得到的错误日志ng new app-name:
Error: Schematic "ng-new" not found in collection "@schematics/angular".
at SchematicEngine.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:155:23)
at CollectionImpl.createSchematic (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\collection.js:12:29)
at NodeWorkflow.execute (C:\Users\xyz\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\workflow\node-workflow.js:70:38)
at Promise (C:\Users\xyz\node_modules\@angular\cli\models\schematic-command.js:141:22)
at new Promise (<anonymous>)
at NewCommand.runSchematic (C:\Users\xyz\node_modules\@angular\cli\models\schematic-command.js:140:16)
at NewCommand.<anonymous> (C:\Users\xyz\node_modules\@angular\cli\commands\new.js:77:25)
at Generator.next (<anonymous>)
at C:\Users\xyz\node_modules\@angular\cli\commands\new.js:7:71
at new Promise (<anonymous>)
Run Code Online (Sandbox Code Playgroud)
为了解决这个问题,我已经重新安装了角度cli以及npm两次以上.包的版本如下:
Package Version
------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
Angular Cli 6.0.0
Node 8.11.1
npm 5.6.0
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激.
编辑:我从安装角度全局包的地方运行new,我可以从那里创建一个应用程序.从其他任何地方运行它会产生错误.
有人可以帮忙解决Angular 6问题吗?
我有一个角6 CLI项目(应用程序),并增加了两个库(可以打电话给他们libA,并libB和libA需要的部件从libB)
我已经导入libB了我的libA模块导入,但是在构建时libA我得到一个错误,它无法找到模块
libB模块
我的libA模块是
import {LibBModule} from ‘@scope/libb’;
…
@NgModule({
imports: [
LibBModule
]
})
export class LibAModule { }
Run Code Online (Sandbox Code Playgroud)
在我的根tsconfig路径中我有
“@scope/lib1": [
"dist/@scope/liba"
],
“@scope/libb": [
"dist/@scope/libb"
]
Run Code Online (Sandbox Code Playgroud)
我已经构建libB并且构建良好并且位于上面的位置,但是当我构建时,libA我得到以下错误
error TS2307: Cannot find module ‘@scope/libb’
Run Code Online (Sandbox Code Playgroud)
我做错了什么?(注意:我正在将libA模块导入我的根项目,这很好),请帮忙吗?
在Angular和Angular CLI更新到v6之后,我的lint配置每次尝试运行时都会引发以下错误ng lint --type-check:
具有多个目标的Architect命令不能指定替代。'lint'将在以下项目上运行:atlas-fe,atlas-fe-e2e
错误:具有多个目标的Architect命令无法指定替代。'lint'将在以下项目上运行:
att -fe,atlas-fe-e2e at LintCommand.validate(/ home / nroma / workspace / atlas / proto-fe / node_modules / @ angular / cli / models / architect-command .js:75:23)
位于/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:274:39 位于/ home / nroma的
Generator.next()
/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:7:71
在
__awaiter(/ home / nroma / workspace / atlas / proto-fe / node_modules / @ angular / cli / models / command-runner.js:3:12)
在Object的 validateAndRunCommand(/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:273:12)中。(/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:100:26)
在Generator.next()
处已实现(/ home / nroma / workspace / atlas /proto-fe/node_modules/@angular/cli/models/command-runner.js:4:58)
我正在使用节点v9.9.0(npm v6.0.1)。
这是我的package.json …
是否可以将常见样式与配置特定样式结合在一起?还是要具体说明一下,使用多种配置构建应用?
我有一个应用程序,它根据构建期间使用的配置使用不同的材质主题。这是build应用程序部分的angular.json外观:
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/my-app",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"scripts": [ ],
"styles": [
// These are the common styles
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
},
"configurations": {
"theme-one": {
"styles": [
"src/styles/themes/material.theme-one.scss"
]
},
"theme-two": {
"styles": [
"src/styles/themes/material.theme-two.scss"
]
}
}
},
Run Code Online (Sandbox Code Playgroud)
?预期行为:
我想添加/合并styles各个配置中styles指定的以及中的指定build:options。例如,使用以下命令:
ng build --configuration theme-one
Run Code Online (Sandbox Code Playgroud)
上面的命令应包含"src/styles.scss"和"src/styles/themes/material.theme-one.scss"。相同theme-two。
?当前行为:
当前行为是,当我指定配置时,该配置中的 …
我目前正在使用Angular 5进行Web项目,并且我想集成Firebase Cloud Messaging以在应用程序上发送通知,但是我遇到了许多我试图修复它们的问题。现在有两个我无法修复的错误:Namespace 'firebase.auth'和functions
错误看起来像:
ERROR in node_modules/angularfire2/auth/auth.d.ts(12,45): error TS2694: Namespace 'firebase.auth' has no exported member 'IdTokenResult'.
node_modules/angularfire2/firebase.app.module.d.ts(2,42): error TS2305: Module '"/Users/gerardtalla/dev/workspaces/ws-parcaune/pms/pms-frontend-2018/node_modules/firebase/app/index"' has no exported member 'functions'.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?我正在使用
角度5
“ firebase”:“ 4.8.0”
“ angularfire2”:“ ^ 5.0.0-rc.5”
“ @ angular / cli”:“〜1.7.3”
如果有人有一个想法不要犹豫,请与我分享。在此先多谢。
firebase google-cloud-functions firebase-cloud-messaging angular5 angular-cli-v6
我有一个大型的(数百个组件)角(5.2.4)应用程序。我升级了以下组件,并能够构建干净的组件,但是所产生的捆绑包尺寸大于v5:
由于已知的JS堆引起悲伤,我们使用如下所示的npm脚本进行构建:
node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --target=production --aot=true --progress=false --env=STAGING
Run Code Online (Sandbox Code Playgroud)
我根据在角度cli中更改的命令将该脚本修改为以下内容:
node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod --aot --progress=false --c=USER
Run Code Online (Sandbox Code Playgroud)
升级之前,我们的主捆绑包大小约为9MB。升级后,约为21MB。任何想法或建议来诊断这一点将不胜感激!
有时当我尝试启动 angular-cli 命令时:
ng build --app myApplication -w
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
EBUSY: resource busy or locked, unlink 'C:\...\inline.bundle.js'
Run Code Online (Sandbox Code Playgroud)
有什么想法可以克服这个问题吗?
如何以编程方式停止针对端口的 CLI 命令的 webpack-dev-server ?
Ctrl-C 等非常适合手动停止服务器。我们基本上是在杀死它。
是否有服务器公开的 API 以发出 STOP 命令或其他什么?
我想在使用CLI generate library命令创建的Angular库中使用Pure.css模块。
我有一个工作区应用程序,在其中运行了generate library用于创建库的命令。该库已成功创建,我可以将其链接并安装到其他项目中。但是我想使用Pure.css库中的网格系统,在工作区应用程序的angular.json文件(包含库的一个)中,我在库项目的构建配置中有样式条目。
"styles": [
"node_modules/purecss/build/pure-min.css",
"node_modules/purecss/build/grids-responsive-min.css"
]
Run Code Online (Sandbox Code Playgroud)
在一个库的组件中,我有一个使用Pure.css规则的标记,例如
<div class="pure-g">
<div class="pure-u-1-3"><p>Thirds</p></div>
<div class="pure-u-1-3"><p>Thirds</p></div>
<div class="pure-u-1-3"><p>Thirds</p></div>
</div>
Run Code Online (Sandbox Code Playgroud)
但是,当我在外部项目中使用组件时,很明显,没有应用样式。
因此,我已将Pure.css样式文件导入相应组件的.css文件中,例如
@import url("node_modules/purecss/build/pure-min.css");
@import url("node_modules/purecss/build/grids-responsive-min.css");
Run Code Online (Sandbox Code Playgroud)
这可行,但我希望将Pure.css库中的样式包含在整个库中,而不是仅包含一个组件。
有没有一种方法可以做到这一点,我已经做了一些搜索但是找不到任何资源,是否可以配置ng-packagr使其在库的构建中包括样式?
我正在使用package.json文件中定义的脚本从包含工作区的项目中构建库
"build:lib": "ng-packagr -p projects/my-library-project/package.json"
Run Code Online (Sandbox Code Playgroud)
以及通常如何将第三方模块安装到库项目中,是否通过工作空间项目安装它们?
感谢您的任何帮助,谢谢。
我正在尝试在Angular 6/7 CLI项目中使用Google Chrome工作区和CSS持久编辑.
在angular.json配置中添加"extractCSS:true"并使用"--source-map = true"标志时,我可以在Chrome中的"sources"和"elements"标签中看到CSS文件,我可以将其映射到在线CSS文件,但在"元素"面板中更改样式时,更改不会持久,也不会保存到文件中.
是否可以使用工作区从Chrome开发工具中编辑组件CSS文件(不弹出应用程序)?
google-chrome google-chrome-devtools angular-cli angular angular-cli-v6
angular-cli-v6 ×10
angular ×8
angular-cli ×6
angular6 ×2
angular5 ×1
firebase ×1
javascript ×1
lint ×1
ng-build ×1
ng-packagr ×1
rxjs6 ×1