Angular Cli更新改变了我的应用程序查找node_modules的位置。我该如何改回来?

时间:2017-09-15 07:28:49

标签: angular angular-cli

版本。

@angular/cli: 1.4.2
node: 6.10.0
os: linux x64
@angular/animations: 4.3.6
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/compiler-cli: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/platform-server: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.4.2
typescript: 2.5.2

在我更新到最新版本的angular-cli

后,此错误开始发生

失败给出的日志。

client?ffdb:119 ./~/script-loader/addScript.js
Module build failed: Error: ENOENT: no such file or directory, open             '/usr/src/app/angular/node_modules/script-loader/addScript.js'
 @ ./~/script-loader!./~/jquery/dist/jquery.min.js 1:0-73
 @ multi script-loader!./~/jquery/dist/jquery.min.js script-    loader!./~/froala-editor/js/froala_editor.pkgd.min.js

期望的功能。

此错误阻止我的应用程序编译。出于某种原因,angular现在正在查找node_modules文件夹的usr / src / app / angular,而它之前没有找到它(它不在那里)。此外,它突然寻找一个脚本加载器模块,该模块在angular-cli更新之前并不存在,并且没有。

我的Angular-cli.json文件如下所示:

{
  "project": {
    "version": "1.0.0-beta.28.3",
    "name": "angular-client"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
  "assets": [
    "assets",
    "favicon.ico"
  ],
  "addons": [
    "../node_modules/font-awesome/fonts/*.+(otf|eot|svg|ttf|woff|woff2)"
  ],
  "index": "index.html",
  "main": "main.ts",
  "polyfills": "polyfills.ts",
  "test": "test.ts",
  "tsconfig": "tsconfig.json",
  "prefix": "app",
  "styles": [
    "styles.css",
    "../node_modules/font-awesome/css/font-awesome.css",
    "../node_modules/froala-editor/css/froala_editor.pkgd.min.css"
  ],
  "scripts": [
    "../node_modules/jquery/dist/jquery.min.js",
    "../node_modules/froala-editor/js/froala_editor.pkgd.min.js"
  ],
  "environmentSource": "environments/environment.ts",
    "environments": {
    "dev": "environments/environment.ts",
    "prod": "environments/environment.prod.ts"
    }
    }
  ],
  "e2e": {
"protractor": {
  "config": "./protractor.conf.js"
}
  },
  "lint": [
    {
  "files": "src/**/*.ts",
  "project": "src/tsconfig.json"
},
{
  "files": "e2e/**/*.ts",
  "project": "e2e/tsconfig.json"
    }
 ],
  "test": {
"karma": {
  "config": "./karma.conf.js"
    }
  },
  "defaults": {
"styleExt": "css",
"prefixInterfaces": false,
"inline": {
  "style": false,
  "template": false
},
"spec": {
  "class": false,
  "component": true,
  "directive": true,
  "module": false,
  "pipe": true,
  "service": true
    }
  }
}

我的tsconfig.app.json文件如下所示:

{
 "compilerOptions": {
    "baseUrl": "",
    "declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
  "../node_modules/@types"
    ]
  }
}

1 个答案:

答案 0 :(得分:1)

事实证明我必须重新启动Docker容器。现在它有效。