Failed to find module: "tns-core-modules/globals", relative to: app/tns_modules/


#1

I just reinstalled Windows and installed Nativescript and all of the other dev stuff I usually use. When I cloned my repo and tried tns run android, the app loads the splash screen in the emulator and then I get:

Failed to find module: “tns-core-modules/globals”, relative to: app/tns_modules/

I have removed and reinstalled node_modules using npm i
I have removed android and ios as platforms and added android again
I have tried updating the project (tns update)
tns --version = 3.4.2
ng -v = Angular CLI: 1.7.0
Typescript = 2.6.2

I’ve googled everywhere and there only seem to be ~3 people who have encountered this error and none of the proposed fixes have helped.

I CAN load a sample project and run it on Android successfully, so I don’t think it’s a PC config issue.

Any help would be greatly appreciated! The app is open source and is located at https://github.com/CoderTonyB/SAFEAlternatives

“dependencies”: {
"@angular/animations": “~5.2.4”,
"@angular/common": “~5.2.4”,
"@angular/compiler": “~5.2.4”,
"@angular/core": “~5.2.4”,
"@angular/forms": “~5.2.4”,
"@angular/http": “~5.2.4”,
"@angular/platform-browser": “~5.2.4”,
"@angular/platform-browser-dynamic": “5.2.4”,
"@angular/router": “~5.2.4”,
“nativescript”: “^3.2.1”,
“nativescript-angular”: “~5.2.0”,
“nativescript-email”: “^1.5.1”,
“nativescript-hook-filter-modules”: “^1.0.5”,
“nativescript-modal-datetimepicker”: “^1.0.3”,
“nativescript-phone”: “^1.3.1”,
“nativescript-sqlite”: “^2.0.1”,
“nativescript-theme-core”: “~1.0.2”,
“reflect-metadata”: “~0.1.8”,
“rxjs”: “~5.5.6”,
“tns-core-modules”: “^3.4.0”,
“zone.js”: “~0.8.2”
},
“devDependencies”: {
“babel-traverse”: “6.4.5”,
“babel-types”: “6.4.5”,
“babylon”: “6.4.5”,
“lazy”: “1.0.11”,
“nativescript-dev-typescript”: “~0.6.0”,
“typescript”: “~2.6.2”
},


#2

After a day of pulling my hair out, this was caused by a plugin I used trying to fix my IOS app store push. The offending plugin was nativescript-hook-filter-modules. Hope this helps someone!


#3

When that happens, you will be able to see a tns_modules folder inside your app folder. Just delete that folder.


#4

I found that solution as well, but there wasn’t a tns_modules in my app folder to delete.