标签: angular-cli-v6

ENOENT:没有node_modules\jquery\dist\jquery.min.js这样的文件或目录

我不确定我做错了什么:

我在这里按照教程,但我不断收到以下错误:

ENOENT:没有这样的文件或目录,打开'C:\ Users\andrewkp\Documents\VSCode\Projects \node_modules\jquery\dist\jquery.min.js'错误:ENOENT:没有这样的文件或目录,打开'C:\用户\ andrewkp \文档\ VSCode \项目\node_modules\jQuery的\ DIST\jquery.min.js'

这是我的angular.json文件.

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "MyProjectName": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "app",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/MyProjectName",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.app.json",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css",
              "../node_modules/bootstrap/dist/css/bootstrap.min.css"
            ],
            "scripts": [
              "../node_modules/jquery/dist/jquery.min.js",
              "../node_modules/bootstrap/dist/js/bootstrap.min.js"
            ]
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                } …
Run Code Online (Sandbox Code Playgroud)

angularjs visual-studio-code angular-cli angular-cli-v6

15
推荐指数
1
解决办法
2万
查看次数

具有多个目标的架构师命令无法指定替代

我正在转换库(ng-app-state)以使用angular cli,现在v6支持库(yay!).

尝试运行某些CLI命令时,它会失败,并显示如下错误:

$ ng test --source-map ng-app-state
Architect commands with multiple targets cannot specify overrides.'test' would be run on the following projects: ng-app-state-monorepo,ng-app-state
Error: Architect commands with multiple targets cannot specify overrides.'test' would be run on the following projects: ng-app-state-monorepo,ng-app-state
    at TestCommand.validate (S:\Programming\git repositories\ng-app-state-monorepo\node_modules\@angular\cli\models\architect-command.js:91:23)
Run Code Online (Sandbox Code Playgroud)

angular-cli angular-cli-v6

14
推荐指数
1
解决办法
4482
查看次数

你如何调试Angular 6库

我正在写一个Angular 6图书馆,无法弄清楚如何进入打字稿.

我用以下方法生成了应用: ng new mylibapp

然后我使用以下方法添加了库: ng g library @abc/cool-lib -p abc

当我表演时: ng build @abc/cool-lib

它会在mylibapp/dist/abc/cool-lib文件夹中生成代码

我现在如何调试此代码并在位于的ts文件中设置断点 mylibapp/projects/abc/cool-lib/src/lib

typescript angular-cli angular ng-packagr angular-cli-v6

13
推荐指数
5
解决办法
4700
查看次数

添加@ ng-bootstrap/ng-bootstrap到anguar cli库抛出错误"必须明确列入白名单"

我正在创建一个角度6项目和一个库使用angular 6.在我的库中,我有一个需要的组件,angular cli所以我添加了它ng g lierary @some/libName.

当我尝试使用命令构建库时,@ng-bootstrap/ng-bootstrap它会抛出以下错误.

Dependency @ng-bootstrap/ng-bootstrap must be explicitly whiteliste
Run Code Online (Sandbox Code Playgroud)

有没有人解决过它?

ng-bootstrap angular6 angular-cli-v6

12
推荐指数
2
解决办法
6323
查看次数

NG6:库提供的服务未定义

我正在寻找帮助/指针/指导来调试/理解派生类的问题,该派生类在Angular 6项目中扩展了库提供的服务.

我试图将现有的Angular 5.x项目转换为angular.jsonAngular 6项目中的新工作区格式.

我现有的项目包括一个Angular应用程序和一个NgModule提供服务和其他功能的独立共享.共享模块将在多个应用程序中使用,结构如下:

project-root/
    library/
    main-app/
    other-app/
Run Code Online (Sandbox Code Playgroud)

在我现有的NG5代码中,共享库npm link作为TS源文件进入主应用程序(尽管CLI团队明确不推荐,但它适用于我的团队的工作流程).

在NG6应用程序中,library是一个内部的库项目angular.json,如此构建,并通过路径定义拉入项目tsconfig.json.工作区是标准的NG6布局:

workspace-root/
    dist/...
    node_modules/...
    projects/
        library/
            src/lib/...
        main-app/
            src/app/...
        other-app/
    ...
Run Code Online (Sandbox Code Playgroud)

在大多数情况下,库中提供的服务按原样使用,但可以在主应用程序(或其他应用程序)中进行扩展,以提供特定于应用程序的功能.这在Angular 5中工作正常,但在Angular 6中,我在控制台中尝试加载页面时出现以下错误(ng serve运行时):

Object prototype may only be an Object or null

警告发生在这里:

export class FooService extends FooBaseService { // ...
--------------------------------^
Run Code Online (Sandbox Code Playgroud)

当引导进程实例化FooService时,FooBaseService以'undefined'形式出现.

根据研究,这个错误通常与循环依赖问题有关,但我不认为这是正在发生的事情.我在构建库时遇到任何circ-dep警告,或构建主应用程序的任何问题.此外,运行madge -c (链接)在任何一个dist/library或中找不到任何circ-deps dist/main-app.

我对如何继续调试此问题感到困惑.有谁更深入地了解Angular 6如何处理模块提供的服务,他们可能能够指出我正确的方向?

typescript angular angular6 angular-cli-v6

12
推荐指数
1
解决办法
444
查看次数

使用Angular-CLI 6.1.2创建新项目时出错

我尝试使用ng new angular-6-boilerplateangular-cli最新版本创建一个新的Angular项目,但我不能再这样做了.我正在使用windows终端来创建我的项目,但是我收到了这个错误.

原理图输入不对Schema进行验证:{"name":"angular-6-boilerplate","version":"6.1.2","newProjectRoot":"projects","skipInstall":false,"linkCli": false,"skipGit":false,"commit":null}错误:

  Data path ".name" should match format "html-selector".
Run Code Online (Sandbox Code Playgroud)

为什么我收到此错误?

typescript angular-cli angular angular6 angular-cli-v6

12
推荐指数
3
解决办法
6912
查看次数

ASP.NET Core 2.1 Angular 6.0 SPA模板 - 用于索引而非静态页面的razor页面(cshtml)

我想我的迁移ASP.NET Core 2.0 Angular 5与应用程序webpack安装到ASP.NET Core 2.1 Angular 6使用Angular-Cli.

简短的问题:

如何强制从解析剃刀页的指令cshtmlMicrosoft.AspNetCore.SpaServices.Extensions

我不希望使用index.htmlAngular.json,但index.cshtml.

详细描述:

我从Angular模板开始了一个新的ASP.NET Core项目.有很多东西可以神奇地起作用.

  1. index.html文件ClientApp/src夹内有一个文件,在应用程序启动时会自动提供.
  2. 当应用程序运行时,才</body>从标签index.html几个脚本插入(从第一个点)inline.bundle.js,polyfills.bundle.js,vendor.bundle.js,main.bundle.jsstyles.bundle.css之前</head>的标签.

我不确定是谁插入了这些脚本,但我想将它们插入到Razor页面(cshtml)中.

我试图使用旧项目中的代码:

<!DOCTYPE html>
<html>
<head>
    <base href="/" />
    <title>@ViewData["Title"]</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
@{string googleAnalyticsId …
Run Code Online (Sandbox Code Playgroud)

asp.net-core angular-cli angular asp-net-core-spa-services angular-cli-v6

11
推荐指数
3
解决办法
4264
查看次数

指定的模块不存在 Angular 6

你能告诉我为什么我不能在 CLI 下使用吗?它说Specified module does not exist。两个 CLI 命令的错误相同。

注意:我已将此应用程序从 升级ng 5ng 6. 这是由于升级问题导致的错误吗?

ng generate component messages --module=core

ng generate component messages --module=app
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

app.core.module.ts

export class CoreModule {
  static forRoot(): ModuleWithProviders {
    return {
      ngModule: CoreModule
    };
  }
}
Run Code Online (Sandbox Code Playgroud)

app.module.ts

export class AppModule { }
Run Code Online (Sandbox Code Playgroud)

ng --version

Angular CLI: 6.0.8
Node: 8.11.2
OS: win32 x64
Angular: 6.0.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router …
Run Code Online (Sandbox Code Playgroud)

typescript angular-cli angular angular6 angular-cli-v6

10
推荐指数
3
解决办法
1万
查看次数

运行ng serve时无效的JSON字符

运行ng服务时出现以下错误...

PS F:\Projects\RecipeApp> ng serve
Invalid JSON character: "\"" at 76:13.
Error: Invalid JSON character: "\"" at 76:13.
    at _token (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:63:19)
    at _readArray (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:316:9)
    at _readValue (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:561:22)
    at _readProperty (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:398:19)
    at _readObject (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:431:30)
    at _readValue (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:564:22)
    at _readProperty (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:398:19)
    at _readObject (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:431:30)
    at _readValue (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:564:22)
    at _readProperty (F:\Projects\RecipeApp\node_modules\@angular-devkit\core\src\json\parser.js:398:19)
Run Code Online (Sandbox Code Playgroud)

我正在使用角度版本6

angular angular-cli-v6

9
推荐指数
2
解决办法
5827
查看次数

无法从我的角度库组件导入json

如果你想帮我检查一下发生了什么,这里是Github的存储库:https://github.com/sandrocsimas/ngx-material-palette-picker

我正在尝试创建我的第一个角度库.我使用angular cli命令生成代码:

ng new ngx-material-palette-picker-app
ng generate library ngx-material-palette-picker
Run Code Online (Sandbox Code Playgroud)

NgxMaterialPalettePickerComponent我正在导入json文件的组件中,但构建引发了以下错误:

projects/ngx-material-palette-picker/src/lib/ngx-material-palette-picker.component.ts(2,31): error TS2307: Cannot find module './palettes.json'.
Run Code Online (Sandbox Code Playgroud)

这是我的组成部分:

import {Component, OnInit} from '@angular/core';
import * as palettesJSON from './palettes.json';

@Component({
  selector: 'ngx-mpp',
  template: `,
  styles: []
})
export class NgxMaterialPalettePickerComponent implements OnInit {

  constructor() {

  }
}
Run Code Online (Sandbox Code Playgroud)

我创建了一个types在根路径中调用的目录,并将以下代码添加到index.d.ts:

declare module '*.json' {
  const value: any;
  export default value;
}
Run Code Online (Sandbox Code Playgroud)

我还添加了目录typestypeRoots主tsconfig.json.

"typeRoots": [
  "node_modules/@types",
  "types"
],
Run Code Online (Sandbox Code Playgroud)

该项目在Sublime编辑器中没有显示任何错误,但是当我尝试使用该命令构建项目时,ng build …

angular-cli angular angular-cli-v6

8
推荐指数
1
解决办法
904
查看次数