Nativescript-cli: Unable to apply changes on device: emulator-XXXX. Error is: Cannot read property 'env' of undefined

Created on 21 Jun 2019  路  4Comments  路  Source: NativeScript/nativescript-cli

@shineklbm commented on Thu Jun 20 2019

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 5.4.2
  • Cross-platform modules:5.4.2
  • Android Runtime:5.4.0
  • iOS Runtime:5.4.2
  • Plugin(s): "nativescript-ui-sidedrawer": "^4.3.0", "nativescript-plugin-firebase": "^7.7.0", "nativescript-downloader": "^2.1.4",

Describe the bug
After upgrading upgrading the project, when I run, tns run android --bundle or tns run ios --bundle, I am getting Unable to apply changes on device: emulator-XXXX. Error is: Cannot read property 'env' of undefined.

To Reproduce
npm install -g nativescript
tns update
tns run android --bundle
tns run ios --bundle

Expected behavior
It should run the app inside emulator.


@keithgulbro commented on Thu Jun 20 2019

@shineklbm I had the same issue, here's an a vue reference I found https://github.com/vuejs/vue-cli/issues/4177

If you're using Nativescript-Vue CLI like I am, it seems there's some major issues that arose over the last 24 hours.

Most helpful comment

Hey all,
The error indicates you are using one of the next versions of nativescript-dev-webpack. As we are preparing the next major version of NativeScript (6.0.0), the next version of nativescript-dev-webpack is compatible only with it. So you should either use next versions of both CLI and nativescript-dev-webpack or their official versions.

NOTE: Do not forget to update your webpack.config.js when changing nativescript-dev-webpack versions, i.e. after installing the new version, execute ./node_modules/.bin/update-ns-webpack --configs

All 4 comments

any update here? I am still getting this error

I was able to resolve this issue, by running the npm ci (clean install) instead of npm install or tns install. I think it is happening due to some node modules update. Anyway thanks for the support.

@shineklbm try executing uninstall before updating (or as shown above use clean install)

npm uninstall -g nativescript
npm i -g nativescript

Hey all,
The error indicates you are using one of the next versions of nativescript-dev-webpack. As we are preparing the next major version of NativeScript (6.0.0), the next version of nativescript-dev-webpack is compatible only with it. So you should either use next versions of both CLI and nativescript-dev-webpack or their official versions.

NOTE: Do not forget to update your webpack.config.js when changing nativescript-dev-webpack versions, i.e. after installing the new version, execute ./node_modules/.bin/update-ns-webpack --configs

Was this page helpful?
0 / 5 - 0 ratings