0

I am trying to upgrade an older project to run with the latest NativeScript version. I am following the steps outlined in the NativeScript Upgrade page. As far as I can tell this project was working with 4.2.0 of the platform, and 6.1.0 of the Angular libraries, as well as the following dev-dependencies:

    "nativescript-dev-typescript": "~0.7.3",
    "nativescript-dev-webpack": "0.15.1",

When I run the command npm i nativescript-dev-typescript@latest --save-dev to update TS, the file used in the next step: ./node_modules/.bin/ns-upgrade-tsconfig is missing. The same happens with the webpack step.

I tried ignoring this and completed the other upgrade steps, yet when I attempt to run my app I get errors that point me to this article that leaves me in the same situation (./node_modules/.bin/update-ns-webpack --deps --configs fails to run as the file is missing)

I have tried downloading the .zip files from github and manually adding these scripts into my .bin folder, however they fail to run with missing dependencies.

Finally as a last resort I reverted all of my changes to the app, and try to build and it fails, I assume because I have the latest version of NativeScript installed now. N.B. The app was building and working fine before I tried to do the upgrade steps.

Here is the current error I am getting (after reverting everything and attempting to build with Sidekick)

[19-04-15 14:46:04.000] Error detected during LiveSync on emulator-5554 for D:\Documents\GitHub\geonasium-app. Error: Command gradlew.bat failed with exit code 1 Error output: 
 Exception in thread "main" java.io.IOException: Couldn't find 'D:\Documents\GitHub\geonasium-app\platforms\android\build-tools\sbg-bindings.txt' bindings input file. Most probably there's an error in the JS Parser execution. You can run JS Parser with verbose logging by executing "node 'D:\Documents\GitHub\geonasium-app\platforms\android\build-tools\jsparser\js_parser.js' enableErrorLogging".
    at org.nativescript.staticbindinggenerator.Generator.generateBindings(Generator.java:126)
    at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:97)
    at org.nativescript.staticbindinggenerator.Main.main(Main.java:48)
FAILURE: Build failed with an exception.

Ultimately I would just like to get my app updated to the latest NativeScript, TypeScript, Webpack and Angular

UPDATE I deleted package-lock.json, tsconfig.json and webpack.js, as well as removed reference to nativescript-dev-typescript and nativescript-dev-webpack from package.json. I cleaned the hooks, node_modules and platforms folders and ran the upgrade steps again.

This time the TypeScript step was succesful and I have the ns-upgrade-tsconfig script in my node_modules/.bin folder however the webpack step failed and it's upgrade script is still missing.

Rohan
  • 456
  • 3
  • 16
  • try running with `--bundle` – Narendra Apr 15 '19 at 05:10
  • I have faced this issue and upgraded my android sdk and build tools as well. Android SDK 28 or later is required to build for Android devices – Narendra Apr 15 '19 at 05:19
  • Also do a cleaup before upgrade tns platform remove android `tns platform remove ios rm -rf node_modules rm -rf platforms rm -rf hooks` – Narendra Apr 15 '19 at 05:20
  • @Narendra this is in Sidekick, I can't add the `--bundle` flag but I'll try building in the CLI. I have also updated to the latest API/SDK within Android Studio, the `tns update` command removes platforms as well so I doubt removing it manually will help. – Rohan Apr 15 '19 at 22:54

1 Answers1

0

It eventually clicked that the problem was that devDependencies weren't being installed at all. What causes devDependencies to not install?

NODE_ENV=production

devDependencies do not install if the NODE_ENV is set to production, because obviously we don't install development dependencies in a production environment.

Setting the environment variable back to production has solved the problem.

Rohan
  • 456
  • 3
  • 16