i have a project i worked on some years back on my previous laptop(Samsung, Windows OS). I needed to refer back to that project recently so i move the source code to my current laptop (Mac M1). Upon running the app i got a bunch of errors. About 57 errors like this:
ERROR in ./node_modules/nativescript-screenshot/index.js 1:18-41
Module not found: Error: Can't resolve 'image-source' in '/Users/ad8kunle/Documents/nativescript-projects/skogapp/node_modules/nativescript-screenshot'
@ ./app/profile/profile.js 10:13-47
@ ./app/ sync .(xml%7Cjs%7Cs?css)$ ./profile/profile.js
@ ./node_modules/@nativescript/webpack/dist/stubs/virtual-entry-javascript.js 3:16-89
ERROR in ./node_modules/nativescript-toast/toast.android.js 3:18-40
Module not found: Error: Can't resolve 'application' in '/Users/ad8kunle/Documents/nativescript-projects/skogapp/node_modules/nativescript-toast'
@ ./app/home/home-page.js 10:12-41
@ ./app/ sync .(xml%7Cjs%7Cs?css)$ ./home/home-page.js
@ ./node_modules/@nativescript/webpack/dist/stubs/virtual-entry-javascript.js 3:16-89
ERROR in ./app/welcome/slides-view.js 2:47-80
Module not found: Error: Can't resolve 'ui/layouts/grid-layout' in '/Users/ad8kunle/Documents/nativescript-projects/skogapp/app/welcome'
@ ./app/ sync .(xml%7Cjs%7Cs?css)$ ./welcome/slides-view.js
@ ./node_modules/@nativescript/webpack/dist/stubs/virtual-entry-javascript.js 3:16-89
I ran tns --version
on my previous laptop and its version 6.3. However, my current version is 8.3.2
My package.json looks like
"dependencies": {
"@nativescript/core": "~8.3.0",
"@nstudio/nativescript-cardview": "^2.0.0",
"@nstudio/nativescript-pulltorefresh": "^1.1.1",
"@progress-nativechat/nativescript-nativechat": "3.0.0",
"nativescript-accelerometer": "3.0.0",
"nativescript-background-http": "4.2.1",
"nativescript-blur": "^2.0.0",
"nativescript-camera": "4.5.0",
"nativescript-contacts": "^1.6.2",
"nativescript-exit": "^1.0.1",
"nativescript-fancyalert": "^3.0.9",
"nativescript-floatingactionbutton": "^5.1.0",
"nativescript-geolocation": "5.1.0",
"nativescript-image": "3.0.1",
"nativescript-image-cache-it": "^5.0.0-beta.20",
"nativescript-image-colors": "^1.1.0",
"nativescript-image-filters": "^2.2.2",
"nativescript-imagepicker": "7.1.0",
"nativescript-intl": "3.0.0",
"nativescript-iqkeyboardmanager": "1.5.1",
"nativescript-permissions": "^1.3.8",
"nativescript-phone": "^1.4.1",
"nativescript-plugin-firebase": "^10.5.2",
"nativescript-plugin-universal-links": "^1.0.1",
"nativescript-pulltorefresh": "^2.3.0",
"nativescript-ripple": "^2.2.1",
"nativescript-root-detection": "^1.0.0",
"nativescript-screenshot": "0.0.2",
"nativescript-social-share": "1.6.0",
"nativescript-sqlite": "^2.6.0",
"nativescript-status-bar": "^1.2.0",
"nativescript-theme-core": "~1.0.6",
"nativescript-toast": "^2.0.0",
"nativescript-ui-autocomplete": "6.0.1",
"nativescript-ui-calendar": "6.1.0",
"nativescript-ui-chart": "7.1.1",
"nativescript-ui-dataform": "6.0.0",
"nativescript-ui-gauge": "6.0.0",
"nativescript-ui-listview": "8.0.1",
"nativescript-ui-sidedrawer": "8.0.0",
"nativescript-urlhandler": "^1.3.0",
"nativescript-web-image-cache": "^5.0.0",
"nativescript-web-image-cache-with-fresco": "^2.0.2",
"nativescript-webrtc-plugin": "^2.0.0-alpha.22"
},
"devDependencies": {
"@nativescript/android": "8.3.0",
"@nativescript/webpack": "~5.0.0"
},
Already tried tns --migrate
. That was whqt reduced the errors to 57. there were 215 before.
It's a HUGE jump to go from {N} v6 to v8, with lots of breaking changes. I bit the bullet and spent several months making the upgrade myself earlier this year. (To be fair, I was also making UI changes during the upgrade).
As a start, watch this video, probably at least twice: Migrating Legacy NativeScript 6 Project to 8
Good luck!