NativeScript 8.2.0 upgrade fails to build: Unknown option '--env.hmr'

778 Views Asked by At

After upgrading my NativeScript Angular app from version 8.1.5 to 8.2.0, it now fails to build:

ns run ios
Searching for devices...
Copying template files...
Platform ios successfully added. v8.2.3
Preparing project...
[webpack-cli] Error: Unknown option '--env.hmr'

If I start passing the --no-hmr argument, then it gives a different error:

MacBook-Pro:UI justintoth$ ns run ios --no-hmr
Searching for devices...
Preparing project...
[webpack-cli] Error: Unknown option '--env.externals=~/package.json'
[webpack-cli] Run 'webpack --help' to see available commands and options
Preparing project...
Multiple errors were thrown:
Executing webpack failed with exit code 2.
Package subpath './package.json' is not defined by "exports" in /Users/justintoth/Dev/housters/UI/node_modules/crypto-random-string/package.json

At first I thought it must be an issue with the crypto-random-string package, however if I remove that then it gives the same error about my sass package.

Any ideas of how to get NativeScript Angular 8.2.0 to build/run?

1

There are 1 best solutions below

1
mktaunt On

I got this resolved by updating my local nativescript cli to the latest version. I was initially updating my global nativescript (using the -g option), and when trying to run a package.json script it was using my local version which was running an outdated webpack configuration. npm uninstall nativescript, then npm install nativescript@latest (without -g) sorted it out.