标签: angular-cli

Angular2使用threejs Orbitcontrols

我试图在我的angular(cli)2 app中使用threejs例子.

所以我安装了threejs:

npm install three --save
Run Code Online (Sandbox Code Playgroud)

然后添加了打字:

npm install @types/three --save-dev
Run Code Online (Sandbox Code Playgroud)

最后我的组件看起来像这样:

import { Component, OnInit } from '@angular/core';
import * as THREE from 'three';

@Component({
    selector: 'app-testthreejs',
    templateUrl: './testthreejs.component.html',
    styleUrls: ['./testthreejs.component.css']
})
export class TestthreejsComponent implements OnInit {
//
}
Run Code Online (Sandbox Code Playgroud)

有了这个,我可以使用三个功能,没有任何问题.

我想使用node_modules/three/examples/js /中的一些例子,更准确地说是OrbitControl.这些打字给我在visual studio代码中自动完成: vscode

但是一旦我尝试使用它,我有以下错误:

TypeError:WEBPACK_IMPORTED_MODULE_1_three .OrbitControls不是构造函数

有没有办法通过一些导入提供OrbitControls(和其他例子)?我应该只在我的HTML中包含control.js吗?

处理这个问题的最佳方法是什么?

three.js angular-cli angular

10
推荐指数
2
解决办法
3600
查看次数

Angular 2 - angular-cli:在构建时设置全局变量

这是我第一次尝试部署Angular2应用程序.我想设置API端点的URL,我希望它在每个环境中都有所不同.

有没有办法制作ng版本或任何其他工具,允许在部署之前为我设置?

angular-cli angular

10
推荐指数
2
解决办法
5982
查看次数

模块构建失败:TypeError:无法读取未定义的属性"newLine"

在此输入图像描述

昨天一切都运行正常,现在当我尝试服务时,我得到了这些错误:

./src/main.ts中的错误模块构建失败:TypeError:无法读取Object.getNewLineCharacter上未定义的属性'newLine'(/Users/leongaban/Projects/TickerTags/wikitags/node_modules/typescript/lib/typescript.js:8062 :20)

我在这里和这里尝试了答案,但没有效果:(

我对angular-cli的全局和本地npm版本是1.0.0-beta.28.3如何将其升级到.30的?我试过了@latest


我的本地package.json:

"devDependencies": {
    "@angular/cli": "1.0.0-beta.28.3",
    "@angular/compiler-cli": "^2.4.0",
Run Code Online (Sandbox Code Playgroud)

我的全球套餐:

在此输入图像描述


我看到最新的是beta.32 https://github.com/angular/angular-cli/releases

但是,当我运行npm install -g angular-cli@latest它仍然安装.28.3

javascript angular-cli angular

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

什么被捆绑到vendor.bundle.js?

angular-cli在执行构建时生成vendor.bundle.js.

在vendor.bundle.js下将被视为包装的规则是什么?

webpack angular-cli angular

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

index.html没有加载本地CSS

我最近开始使用AngularCLI.我已将所有文件从Angular2转移到AngularCLI项目.

但它没有加载一些本地的CSS文件,但它正在加载其他的CSS文件?

目前的目录是:

-src
--index
--styles.css
--app
---angular2-fullcalendar
----fullcalendar.min.css
Run Code Online (Sandbox Code Playgroud)

的index.html

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Cudyangularcli</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="stylesheet" type="text/css" href="styles.css">
  <link rel="stylesheet" type="text/css" href="../src/app/angular2-fullcalendar/fullcalendar.min.css" >
</head>
<body>
  <app-root>Loading...</app-root>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

错误是: 在此输入图像描述

angular-cli angular

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

如何将自定义css和js添加到angular 4

在角度2中,我可以像这样在index.html中添加它们:

<link rel="stylesheet" href="css/mycss.css">
Run Code Online (Sandbox Code Playgroud)

但是在角度4中,必须将它添加到样式和脚本数组部分中的angular-cli.json文件中.

在我的情况下,它们似乎根本没有装载.没错,但是当我在浏览器中查看应用程序时,我知道样式没有加载.当我将样式和js添加到index.html文件时,它也没有被加载,我在控制台中得到了404.

我该如何解决?下面是我的Angular cli版本:@ angular/cli:1.0.2节点:6.9.2

node.js typescript angular-cli angular

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

使用角度cli处理多个应用程序

我感兴趣的是能够使用角度cli来引导多个应用程序.

通过angular-cli wiki,我找到了一个例子 https://github.com/angular/angular-cli/wiki/stories-multiple-apps

我也发现了 https://yakovfain.com/2017/04/06/angular-cli-multiple-apps-in-the-same-project/

我浏览了angular-cli.json文件并运行了

    "apps": [
    {
      "name": "app1",
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    },
    {
      "name": "app2",
      "root": "src",
      "outDir": "dist2",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main2.ts",
      "polyfills": "polyfills2.ts",
      "test": "test2.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app2",
      "styles": [
        "styles.css" …
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

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

Angular从第5版降级到第4版

我想,当我运行此命令的版本降级到角CLI 4创建角4项目,而不是5角我CLI版本1.5.0

npm install -g angular-cli@1.4.9
Run Code Online (Sandbox Code Playgroud)

我收到了错误

npm ERR! code ETARGET
npm ERR! notarget No matching version found for angular-cli@1.4.9
Run Code Online (Sandbox Code Playgroud)

angular-cli angular

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

无法运行新的Angular CLI项目

我有一份面试的家庭作业.它需要在Angular中完成,所以我想在开始之前我会快速升级Node.js,NPM和Angular CLI.看起来这是一个坏主意.

在运行我的命令之后:ng new project-name --style scss一切似乎都很好.但是当我运行时,ng serve我收到以下错误:

Cannot find module 'uglifyjs-webpack-plugin'
Error: Cannot find module 'uglifyjs-webpack-plugin'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/andybarratt/dev/project-name/node_modules/@angular/cli/models/webpack-
configs/production.js:13:24)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/andybarratt/dev/project-name/node_modules/@angular/cli/models/webpack-
configs/index.js:9:10)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
Run Code Online (Sandbox Code Playgroud)

我无法在任何地方找到任何涉及Angular的错误.正如我所说,这是一个完全干净的项目; 我还没有开始编码.

跑步ng --version给了我这个:

    _                      _                 ____ …
Run Code Online (Sandbox Code Playgroud)

npm angular-cli angular

10
推荐指数
2
解决办法
3016
查看次数

缺少*.ts文件(由于`npm link`?)

我在Angular5项目中有这个import语句:

import {plugins, SCECodeGenType} from 'sce-plugins/code-generation';
Run Code Online (Sandbox Code Playgroud)

这解析了我的文件系统上的这个路径:

/Users/.../suman-chrome-extension/node_modules/sce-plugins/code-generation/index.d.ts
Run Code Online (Sandbox Code Playgroud)

在构建应用程序时ng build -w,我收到此错误:

ERROR in ../sce-plugins/code-generation/index.ts Module build failed: Error: /Users/alexamil/WebstormProjects/oresoftware/sumanjs/sce-plugins/code-generation/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (/Users/alexamil/WebstormProjects/oresoftware/sumanjs/suman-chrome-extension/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:662:23)
    at plugin.done.then (/Users/alexamil/WebstormProjects/oresoftware/sumanjs/suman-chrome-extension/node_modules/@ngtools/webpack/src/loader.js:467:39)
    at <anonymous>  @ ./src/app/shared/services/lang.service.ts 14:24-62  @ ./src/app/app.module.ts  @ ./src/main.ts  @ multi ./src/main.ts
Run Code Online (Sandbox Code Playgroud)

我相信这是因为我npm link用来链接'sce-plugins'项目以进行本地开发.

我npm link在这里看到与Angular5项目一起使用的一些问题:

https://github.com/angular/angular-cli/issues/3875

https://github.com/angular/angular-cli/issues/8677

https://github.com/angular/angular-cli/issues/9376

有谁知道如何解决?

更新:

它似乎与npm linkperse或符号链接没有关系.如果我只是将本地目录复制到node_modules/sce-plugins,我会得到同样的错误. …

typescript tsc angular-cli angular angular5

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

标签 统计

angular ×10

angular-cli ×10

typescript ×2

angular5 ×1

javascript ×1

node.js ×1

npm ×1

three.js ×1

tsc ×1

webpack ×1