Charles Desbiens
Charles Desbiens

Reputation: 1079

Angular Cli update changed the location where my app looks for node_modules. How do I change it back?

Versions.

@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

This error started occurring after I updated to the latest version of angular-cli

The log given by the failure.

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

Desired functionality.

This error prevents my application from compiling. For some reason angular is now looking in usr/src/app/angular for the node_modules folder, whereas it wasn't looking there before(it's not there). Furthermore, it's suddenly looking for a script loader module, which doesn't exist, and didn't before the angular-cli update.

My Angular-cli.json file looks like this:

{
  "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
    }
  }
}

And my tsconfig.app.json file looks like this:

{
 "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"
    ]
  }
}

Upvotes: 0

Views: 410

Answers (1)

Charles Desbiens
Charles Desbiens

Reputation: 1079

It turns out I had to restart the Docker container. Now it works.

Upvotes: 1

Related Questions