I just updated to NPM 5.0.1 and right away I had compilation errors in my Angular 4.1.3 project. After deleting and completely reinstalling my node_modules (all packages up to date) I get a strange and red colored error when running ng serve
:
Invalid Version: https://registry.npmjs.org/@angular/core/-/core-4.1.3.tgz
TypeError: Invalid Version: https://registry.npmjs.org/@angular/core/-/core-4.1.3.tgz
at new SemVer (/Users/bracicot/dev/recruitler/node_modules/semver/semver.js:293:11)
at new Version (/Users/bracicot/dev/recruitler/node_modules/@angular/cli/upgrade/version.js:23:36)
at Function.assertAngularVersionIs2_3_1OrHigher (/Users/bracicot/dev/recruitler/node_modules/@angular/cli/upgrade/version.js:80:23)
at Class.run (/Users/bracicot/dev/recruitler/node_modules/@angular/cli/commands/serve.js:102:27)
at Class.Command.validateAndRun (/Users/bracicot/dev/recruitler/node_modules/@angular/cli/ember-cli/lib/models/command.js:128:15)
at /Users/bracicot/dev/recruitler/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:92:22
at tryCatch (/Users/bracicot/dev/recruitler/node_modules/rsvp/dist/rsvp.js:539:12)
at invokeCallback (/Users/bracicot/dev/recruitler/node_modules/rsvp/dist/rsvp.js:554:13)
at /Users/bracicot/dev/recruitler/node_modules/rsvp/dist/rsvp.js:629:16
at flush (/Users/bracicot/dev/recruitler/node_modules/rsvp/dist/rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:95:7)
at process._tickCallback (internal/process/next_tick.js:161:9)
I'm kind of stumped as to what could be causing this short of rolling back NPM. There doesnt seem to be anything online about it either.
UPDATE: NPM added a package-lock.json file. The Invalid Version is coming from there.
UPDATE 2:
After reinstalling the CLI I get
Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
could it be that the package.json
and package-lock.json
are not in sync?
UPDATE 3: Special thanks to @Dylanb124 Yes NPM5 is certainly buggy, the first issue was the package-lock file being created with incorrect values... There is a lot to this issue and I have resolved it. My dev partner was able to get NPM 5 working with a fresh NG project. Therefore we matched the working version against our repo until it built properly. The main conflicts were packages that supported node and mongo (hammer.js) and some others that I was able to remove permanently. (some cleanup was due anyways) in the end we were able to get it running. I would recommend waiting as long as possible to upgrade to NPM 5x
What worked for me on npm 5.0.2
delete node_modules
rm -f package-lock.json && npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With