Angular-cli: Updating Angular CLI & Core: "Cannot read property 'split' of null"

Created on 19 Oct 2018  路  11Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [X] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

  • Node version: 8.11.4
  • npm version: 6.4.1
  • Angular version: 6.1.8
  • Angular CLI version: 6.2.3
  • OS: Windows 10 x64
  • (rxjs: 6.2.2)
  • (typescript: 2.9.2)

Repro steps

Using Angular with Angular Fire, Angular Flex, ngxs, firebase, rxjs.
Ran command:
ng update @angular/cli @angular/core

The log given by the failure

Only got this one line, nothing else:
Cannot read property 'split' of null

Desired functionality

A working update would be the best, at least some more details on why Angular couldn't be updated would be nice.

Mention any other details that might be useful

schematicupdate medium more info broken bufix

Most helpful comment

I solved this issue by temporarily removing one package under"dependencies" of package.json.

For my specific case, it was "angular-instantsearch": "^2.0.4" to be removed then reinstalled after the ng update.

All 11 comments

I solved this issue by temporarily removing one package under"dependencies" of package.json.

For my specific case, it was "angular-instantsearch": "^2.0.4" to be removed then reinstalled after the ng update.

I can confirm that wduville's fix worked for me as well

Wduville's fix worked for me too.

AFAICT, the error OP is seeing comes from this line of semver. Range constructor from semver is not designed to support range = null.
Ran as part of ng update, this line here transforms an invalid range into null which will fail down the line.

same error with me, and I cant tell what the problem . any idea ?

Hi, can someone please share your package.json togather with the exact command that you are using to update?

Thanks.

@alan-agius4 I just ran into this problem today, here's the command I'm running:

npx ng update @angular/cli @angular/core

When running the ng update command above, all I get for output is:

# npx ng update @angular/cli @angular/core
Cannot read property 'split' of null

Removing dev deps still has the issue, removing everything but Angular packages from dependencies lets the installer proceed, but still fails with:

# npx ng update @angular/cli @angular/core
                  Package "@angular/http" has a missing peer dependency of "rxjs" @ "^6.0.0".
                  Package "@angular/core" has a missing peer dependency of "rxjs" @ "^6.0.0".
                  Package "@angular/common" has a missing peer dependency of "rxjs" @ "^6.0.0".
                  Package "@angular/forms" has a missing peer dependency of "rxjs" @ "^6.0.0".
                  Package "@angular/router" has a missing peer dependency of "rxjs" @ "^6.0.0".
                  Package "@angular/compiler-cli" has a missing peer dependency of "typescript" @ ">=3.1.1 <3.2".
Incompatible peer dependencies found. See above.

Here is my package.json (minus some things which I don't think would matter):

  "dependencies": {
    "@3846masa/axios-cookiejar-support": "^0.3.5",
    "@angular-devkit/build-angular": "^0.7.4",
    "@angular/animations": "^6.1.3",
    "@angular/cdk": "^6.4.6",
    "@angular/cli": "^6.1.4",
    "@angular/common": "^6.1.3",
    "@angular/compiler": "^6.1.3",
    "@angular/compiler-cli": "^6.1.3",
    "@angular/core": "^6.1.3",
    "@angular/flex-layout": "^6.0.0-beta.15",
    "@angular/forms": "^6.1.3",
    "@angular/http": "^6.1.3",
    "@angular/language-service": "^6.1.3",
    "@angular/platform-browser": "^6.1.3",
    "@angular/platform-browser-dynamic": "^6.1.3",
    "@angular/router": "^6.1.3",
    "@ngx-progressbar/core": "^5.0.1",
    "@ngx-progressbar/http": "^5.0.1",
    "@ngx-progressbar/router": "^5.1.2",
    "@ngxs/router-plugin": "^3.2.0",
    "@ngxs/store": "^3.2.0",
    "@okta/okta-auth-js": "^1.17.0",
    "@swimlane/ngx-charts": "^9.0.0",
    "ag-grid": "^18.1.2",
    "ag-grid-angular": "^18.1.0",
    "angular2-virtual-scroll": "^0.4.7",
    "archiver": "^2.1.1",
    "async-retry": "^1.2.1",
    "awesome-debounce-promise": "^1.0.0",
    "axios": "^0.18.0",
    "babyparse": "^0.4.6",
    "bluebird": "^3.5.1",
    "body-parser": "^1.18.3",
    "chalk": "^2.4.1",
    "compression": "^1.7.3",
    "compromise": "^11.12.0",
    "confluence-api": "^1.3.0",
    "cookie-parser": "^1.4.3",
    "core-js": "^2.5.5",
    "decko": "^1.2.0",
    "emailjs": "^2.2.0",
    "express": "^4.16.3",
    "express-redis-cache": "^1.1.3",
    "express-validator": "^5.3.0",
    "font-awesome": "^4.7.0",
    "fuse.js": "^3.2.0",
    "gitlab": "^4.0.1",
    "hammerjs": "^2.0.8",
    "highlight.js": "^9.12.0",
    "history": "^4.7.2",
    "invert-color": "^1.2.3",
    "jenkins": "^0.22.1",
    "jimp": "^0.5.4",
    "jira-connector": "^2.8.0",
    "jquery": "^3.3.1",
    "jsnlog": "^2.28.0",
    "jsonwebtoken": "^8.2.1",
    "knex": "^0.15.2",
    "ldapjs": "^1.0.2",
    "loaders.css": "^0.1.2",
    "lodash": "^4.17.10",
    "lodash-inflection": "^1.5.0",
    "magic-query": "^1.1.1",
    "moment": "^2.22.1",
    "moment-duration-format": "^2.2.2",
    "moment-timezone": "^0.5.21",
    "mongoose": "^5.2.7",
    "morgan": "^1.9.0",
    "mysql": "^2.16.0",
    "ng-sidebar": "^8.0.0",
    "ng-snotify": "^4.3.1",
    "ng2-semantic-ui": "^0.10.0-alpha.6",
    "ngx-clipboard": "^11.1.3",
    "ngx-contextmenu": "^5.0.2",
    "ngx-pagination": "^3.2.0",
    "ngx-pipes": "^2.3.5",
    "ngx-quill": "^4.0.0",
    "ngx-webstorage": "^3.0.0-beta.10",
    "node-ssh": "^5.1.2",
    "number-to-words": "^1.2.4",
    "numeral": "^2.0.6",
    "object-hash": "^1.3.0",
    "object-sizeof": "^1.2.0",
    "paginator": "^1.0.0",
    "passport": "^0.4.0",
    "passport-ldapauth": "^2.0.0",
    "per-env": "^1.0.2",
    "pg": "^7.4.3",
    "pluralize": "^7.0.0",
    "popper.js": "^1.14.4",
    "prettyjson": "^1.2.1",
    "prettysize": "^1.1.0",
    "querystring": "^0.2.0",
    "quill": "^1.3.6",
    "randomcolor": "^0.5.3",
    "request-promise": "^4.2.2",
    "rxjs": "^6.2.1",
    "sass-extract": "^2.1.0",
    "sass-extract-loader": "^1.1.0",
    "semantic-ui-forest-themes": "^1.0.3",
    "semantic-ui-sass": "^2.3.1",
    "socket.io": "^2.1.1",
    "socket.io-client": "^2.1.1",
    "socket.io-redis": "^5.2.0",
    "sql-formatter": "^2.3.1",
    "striptags": "^3.1.1",
    "testrail-api": "^1.3.4",
    "tippy.js": "^2.5.4",
    "tough-cookie-file-store": "^1.2.0",
    "ts-node": "^7.0.0",
    "typescript": "^2.9.2",
    "urijs": "^1.19.1",
    "util.promisify": "^1.0.0",
    "web-animations-js": "^2.3.1",
    "winston": "^2.4.2",
    "x-ray": "^2.3.3",
    "xml2js": "^0.4.19",
    "xterm": "^3.5.1",
    "yargs": "^12.0.1",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angularclass/hmr": "^2.1.3",
    "@ngxs/devtools-plugin": "^3.2.0",
    "@ngxs/logger-plugin": "^3.2.0",
    "@types/async": "^2.0.49",
    "@types/async-retry": "^1.2.1",
    "@types/bluebird": "^3.5.23",
    "@types/express": "^4.16.0",
    "@types/highlight.js": "^9.12.3",
    "@types/history": "^4.7.0",
    "@types/jasmine": "^2.8.8",
    "@types/jasminewd2": "^2.0.3",
    "@types/jenkins": "^0.20.1",
    "@types/knex": "^0.14.21",
    "@types/lodash": "^4.14.116",
    "@types/lodash.mixin": "^4.3.4",
    "@types/moment-duration-format": "^2.2.2",
    "@types/moment-timezone": "^0.5.8",
    "@types/mongoose": "^5.2.6",
    "@types/morgan": "^1.7.35",
    "@types/node": "^10.7.1",
    "@types/object-hash": "^1.2.0",
    "@types/pluralize": "0.0.29",
    "@types/prettyjson": "0.0.28",
    "@types/redis": "^2.8.6",
    "@types/request-promise": "^4.1.42",
    "@types/shelljs": "^0.8.0",
    "@types/socket.io": "^1.4.37",
    "@types/socket.io-client": "^1.4.32",
    "@types/socket.io-redis": "^1.0.25",
    "@types/webpack": "^4.4.9",
    "@types/xml2js": "^0.4.3",
    "awesome-typescript-loader": "^5.2.0",
    "codelyzer": "^4.4.3",
    "copy-webpack-plugin": "^4.5.2",
    "gulp-cli": "^2.0.1",
    "jasmine-core": "^3.2.0",
    "jasmine-spec-reporter": "^4.2.1",
    "karma": "^3.0.0",
    "karma-chrome-launcher": "^2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^2.0.1",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^1.2.0",
    "node-memwatch": "^1.0.1",
    "nodemon-webpack-plugin": "^3.0.1",
    "npm-run-all": "^4.1.3",
    "protractor": "^5.4.0",
    "rendertron": "^2.0.1",
    "rimraf": "^2.6.2",
    "shelljs": "^0.8.2",
    "source-map-support": "^0.5.9",
    "tsconfig-paths": "^3.5.0",
    "tslint": "^5.11.0",
    "wait-on": "^2.1.0",
    "webpack-cli": "^3.0.6",
    "webpack-node-externals": "^1.7.2"
  },
  "browser": {
    "fs": false,
    "os": false,
    "path": false
  }

Hi, is this still reproducible with the latest versions of the CLI? I am unable to replicate this, with the above package.json.

I haven't ran into it again.

People experience this issue when some of the libraries they are using have a malformed peerDependency semver syntax. If they update the latter libraries to a newer version that fixes it, the angular updater will not fail.

The PR #12806 makes the ng updated more robust to this issue.

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._

Was this page helpful?
0 / 5 - 0 ratings