preboot/angular-webpack

TypeError: Cannot read property 'query' of undefined

phil123456 opened this issue · 4 comments

Hello,

today, as I did "npm start", there is a new error coming from nowhere
I think it is a webpack version problem, but I am not sure

(hopefully I had a previous version of node_modules from yesterday and it works)

can someone enlight me on what's going on ?

below : errors + package.json

thanks

npm start

> app@0.0.0 start 
> npm run server


> app@0.0.0 server 
> webpack-dev-server --inline --progress --port 8080

config.devtool: #inline-source-map

\node_modules\extract-text-webpack-plugin\index.js:134
        if(!loader.query) return loader.loader;
                  ^

TypeError: Cannot read property 'query' of undefined
    at getLoaderWithQuery (\node_modules\extract-text-webpack-plugin\index.js:134:12)
    at Array.map (native)
    at Function.ExtractTextPlugin.extract (\node_modules\extract-text-webpack-plugin\index.js:201:4)
    at makeWebpackConfig (\webpack.config.js:142:68)
    at Object.<anonymous> (\webpack.config.js:301:2)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at requireConfig (\node_modules\webpack\bin\convert-argv.js:96:18)
    at \node_modules\webpack\bin\convert-argv.js:109:17
    at Array.forEach (native)
    at module.exports (\node_modules\webpack\bin\convert-argv.js:107:15)
    at Object.<anonymous> (\node_modules\webpack-dev-server\bin\webpack-dev-server.js:191:50)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
...

maybe it's an issue in my package.json, but I am a noob at node.js

{
  "name": "app",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "clean": "rimraf node_modules doc dist && npm cache clean",
    "clean-install": "npm run clean && npm install",
    "clean-start": "npm run clean-install && npm start",
    "watch": "webpack --watch --progress --profile",
    "build": "rimraf dist && webpack --progress --profile --bail",
    "build:prod": "rimraf dist && webpack -p",
    "server": "webpack-dev-server --inline --progress --port 8080",
    "webdriver-update": "webdriver-manager update",
    "webdriver-start": "webdriver-manager start",
    "lint": "tslint --force \"src/**/*.ts\"",
    "e2e": "protractor",
    "e2e-live": "protractor --elementExplorer",
    "pretest": "npm run lint",
    "test": "karma start",
    "posttest": "remap-istanbul -i coverage/json/coverage-final.json -o coverage/html -t html",
    "test-watch": "karma start --no-single-run --auto-watch",
    "ci": "npm run e2e && npm run test",
    "docs": "typedoc --options typedoc.json src/app/app.component.ts",
    "start": "npm run server",
    "start:hmr": "npm run server -- --hot",
    "postinstall": "npm run webdriver-update"
  },
  "dependencies": {
    "@angular/common": "4.0.0",
    "@angular/compiler": "4.0.0",
    "@angular/core": "4.0.0",
    "@angular/forms": "4.0.0",
    "@angular/http": "4.0.0",
    "@angular/platform-browser": "4.0.0",
    "@angular/platform-browser-dynamic": "4.0.0",
    "@angular/router": "4.0.0",
    "angular2-cookie": "1.2.6",
    "core-js": "2.4.1",
    "ng2-validation": "4.1.0",
    "reflect-metadata": "0.1.3",
    "rxjs": "5.0.1",
    "zone.js": "0.8.5"
  },
  "devDependencies": {
    "@angularclass/hmr": "1.0.1",
    "@angularclass/hmr-loader": "3.0.2",
    "@types/jasmine": "2.5.41",
    "@types/node": "6.0.38",
    "@types/selenium-webdriver": "2.53.39",
    "angular2-template-loader": "0.6.0",
    "autoprefixer": "6.3.2",
    "awesome-typescript-loader": "3.1.2",
    "codelyzer": "2.0.0",
    "copy-webpack-plugin": "4.0.0",
    "css-loader": "0.26.1",
    "extract-text-webpack-plugin": "2.0.0-beta.4",
    "file-loader": "0.10.0",
    "html-loader": "0.4.0",
    "html-webpack-plugin": "2.8.1",
    "istanbul-instrumenter-loader": "0.2.0",
    "jasmine-core": "2.3.4",
    "jasmine-spec-reporter": "3.2.0",
    "json-loader": "0.5.3",
    "karma": "1.4.1",
    "karma-chrome-launcher": "2.0.0",
    "karma-coverage": "1.0.0",
    "karma-jasmine": "1.0.2",
    "karma-mocha-reporter": "2.0.3",
    "karma-remap-istanbul": "0.2.1",
    "karma-sourcemap-loader": "0.3.7",
    "karma-webpack": "2.0.2",
    "node-sass": "4.5.0",
    "null-loader": "0.1.1",
    "postcss-loader": "1.1.0",
    "protractor": "4.0.10",
    "raw-loader": "0.5.1",
    "remap-istanbul": "0.6.4",
    "rimraf": "2.5.1",
    "sass-loader": "6.0.1",
    "shelljs": "0.7.0",
    "style-loader": "0.13.0",
    "ts-helpers": "1.1.1",
    "tslint": "4.3.1",
    "tslint-loader": "3.3.0",
    "typedoc": "0.5.1",
    "typescript": "2.2.1",
    "url-loader": "0.5.6",
    "webpack": "2.2.1",
    "webpack-dev-server": "2.3.0"
  }
}

Try updating extract-text-webpack-plugin with npm update extract-text-webpack-plugin and see if that helps. You're probably using an outdated version.

I did not change anything in my seed and it used to compile fine

I updated as you recommended, which , as expected, lead to having that query error when starting the application

I dont understand that npm install leads to updating that package since it's version is locked to the one that was in the seed as I dowloaded it

"extract-text-webpack-plugin": "2.0.0-beta.4",

this worked instead

  • setting back the ^ I had removed in the dev Dependencies but it might also bring regressions (which I wanted to avoid)
  • npm install --save-dev extract-text-webpack-plugin@latest

Glad that updating the latest of that dep worked :)