angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Angualr CLI commands not working after trying to upgrade to latest (webpack)

Open theunreal opened this issue 10 years ago • 13 comments

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) Windows
  2. Versions. Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here: All ng commands not working
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

trying to upgrade from angular cli webpack 10 to 11

  1. The log given by the failure. Normally this include a stack trace and some more information.

image

theunreal avatar Sep 01 '16 09:09 theunreal

It seems like it could be related to https://github.com/angular/angular-cli/issues/1883 ?

TL;DR: I think you need to update your Node to version 6.x.x.

Edit: Yip - updating Node from v4.x.x to v6.4.0 did the trick for me.

solms avatar Sep 01 '16 09:09 solms

same here. working hard to fix my machine. I Need it to talk at a meetup about cli!!!!

Windows 10 Node V4.5.0 npm 3.8.7

Last command i tryed before it breaks was to install angular-cli 1.0.0-beta.11-webpack.3.

web-dave avatar Sep 01 '16 09:09 web-dave

@solms Node Version greater 4 not working with node-sass!! I try to reinstall node.

web-dave avatar Sep 01 '16 09:09 web-dave

Upgrading to node 6 resolved this issue but remains another

image

theunreal avatar Sep 01 '16 09:09 theunreal

Reinstall node 4.5 doesn't solve the problm, intall node 6.5 doesn't solve th Problem!!

I get into Panic cause of the talk i give next week.

web-dave avatar Sep 01 '16 09:09 web-dave

I fixed my machine npm install -g [email protected] ng v angular-cli: 1.0.0-beta.11-webpack.2 node: 4.5.0 os: win32 ia32 but now no .d.ts file found

web-dave avatar Sep 01 '16 10:09 web-dave

Updating node to v6 also did work for me too, but another issue has risen, as @theunreal had:

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at Object.getWebpackCommonConfig (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular -cli\addon\ng2\models\webpack-build-common.ts:23:25) at new NgCliWebpackConfig (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\ad don\ng2\models\webpack-config.ts:13:30) at Class.run (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\addon\ng2\tasks \serve-webpack.ts:19:22) at C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\addon\ng2\commands\serve.t s:84:26 at process._tickCallback (internal/process/next_tick.js:103:7)

manuelxtrem avatar Sep 01 '16 10:09 manuelxtrem

You should update your angular-cli.json file with the new version.

{
  "project": {
    "version": "1.0.0-beta.11-webpack.8",
    "name": "ng2-cli-webpack-8"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": "assets",
      "index": "index.html",
      "main": "main.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.json",
      "prefix": "app",
      "mobile": false,
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environments": {
        "source": "environments/environment.ts",
        "prod": "environments/environment.prod.ts",
        "dev": "environments/environment.dev.ts"
      }
    }
  ],
  "addons": [],
  "packages": [],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "css",
    "prefixInterfaces": false,
    "lazyRoutePrefix": "+"
  }
}

nhenneaux avatar Sep 01 '16 12:09 nhenneaux

Changed the version to "version": "1.0.0-beta.11-webpack.8", but same error

angular-cli: 1.0.0-beta.11-webpack.8 node: 6.5.0 os: win32 x64

Cannot read property 'length' of undefined TypeError: Cannot read property 'length' of undefined at Object.getWebpackCommonConfig (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular -cli\addon\ng2\models\webpack-build-common.ts:23:25) at new NgCliWebpackConfig (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\ad don\ng2\models\webpack-config.ts:13:30) at Class.run (C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\addon\ng2\tasks \serve-webpack.ts:19:22) at C:\Projects\Team Projects Workspace\Workplace Suite - Angular\node_modules\angular-cli\addon\ng2\commands\serve.t s:84:26 at process._tickCallback (internal/process/next_tick.js:103:7)

manuelxtrem avatar Sep 01 '16 13:09 manuelxtrem

Change the package.json. set TypeScript Version from ^2.0.0 to 2.0.0.

This solved my Problem

AND node Version v4.5

web-dave avatar Sep 01 '16 15:09 web-dave

I was having the same problem; fixed it by updating theangular-cli.json carefully as suggested by @nhenneaux. Some attributes such styles or scripts are mandatory.

@manuelxtrem check for apps[0].styles in your angular-cli.json. It's what's making the build fail.

jminuscula avatar Sep 05 '16 11:09 jminuscula

The latest beta.14 should have fixed these issues. See https://github.com/angular/angular-cli/wiki/Upgrading-from-Beta.10-to-Beta.12 on how to update.

filipesilva avatar Sep 16 '16 03:09 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.