Error in tns run android - Failed to find module ".", relative to app/tns_modules
See original GitHub issueDid you verify this is a real problem by searching the NativeScript Forum and the other open issues in this repo?
I asked about it on the forum.
Tell us about the problem
Please, ensure your title is less than 63 characters long and starts with a capital letter. I’m getting this error after updating my project.
Error: com.tns.NativeScriptException: Failed to find module: “.”, relative to: app/tns_modules/
If I open the generated javascript files to see where it is complaining I see this:
var _1 = require(".");
Which platform(s) does your issue occur on?
Android - problem ios builds fine
Please provide the following version numbers that your issue occurs with:
-
CLI: (run
tns --version
to fetch it) 4.1.2 -
Cross-platform modules: (check the ‘version’ attribute in the
node_modules/tns-core-modules/package.json
file in your project) “tns-core-modules”: “^4.1.1”, -
Runtime(s): (look for the
"tns-android"
and"tns-ios"
properties in thepackage.json
file of your project)
"tns-ios": {
"version": "4.1.1"
},
"tns-android": {
"version": "4.1.3"
}
- Plugin(s): (look for the version number in the
package.json
file of your project)
"dependencies": {
"@angular/animations": "~6.0.6",
"@angular/common": "~6.0.6",
"@angular/compiler": "~6.0.6",
"@angular/core": "~6.0.6",
"@angular/forms": "~6.0.6",
"@angular/http": "~6.0.6",
"@angular/platform-browser": "~6.0.6",
"@angular/platform-browser-dynamic": "~6.0.6",
"@angular/router": "~6.0.6",
"async-await": "^0.1.40",
"lodash": "^4.17.10",
"moment": "^2.22.0",
"nativescript-angular": "^6.0.6",
"nativescript-audio": "^4.3.5",
"nativescript-drop-down": "^4.0.1",
"nativescript-orientation": "^2.2.0",
"nativescript-theme-core": "^1.0.4",
"nativescript-ui-listview": "3.5.9",
"nativescript-ui-sidedrawer": "^4.1.1",
"nativescript-unit-test-runner": "^0.3.4",
"nativescript-videoplayer": "^4.1.0",
"nativescript-webview-interface": "^1.4.2",
"nativescript-xmlobjects": "^1.1.4",
"node-sass": "^4.9.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~6.0.0 || >=6.1.0",
"tns-core-modules": "^4.1.1",
"zone.js": "^0.8.26"
}
Please tell us how to recreate the issue in as much detail as possible.
The best approach would be to get your code running in the NativeScript Playground and share the link with us, along with any additional details or steps to reproduce needed for examining the issue there.
This seems to be related to updating to 4.1.2 and my tsconfig file. Here is my ts.config.
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": false,
"noEmitOnError": false,
"skipLibCheck": true,
"lib": [
"es6",
"dom",
"es2015.iterable"
],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
},
"exclude": [
"node_modules",
"platforms"
]
}
Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.
This is the first thrown error line in my generated javascript:
var _1 = require(“.”);
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
@bradrice try to reset the application by deleting
node_modules
,platforms
andhooks
and then rebuilding again.I finally got my app to boot up. For some reason on the last update to 4.1.2 nativescript for android seems to not like importing from barrels.
I had to change my code from:
to:
The strange thing is it was working fine for ios, so the compilers work differently with regard to imports.