nativescript-nodeify
nativescript-nodeify copied to clipboard
Failed to find module "os"
I've been receiving this error intermittently with the 'Cannot find module "file-system/file-system-access"' when trying to run tns run android:
Error: com.tns.NativeScriptException: Failed to find module: "os", relative to: app/tns_modules/
com.tns.Module.resolvePathHelper(Module.java:159)
com.tns.Module.resolvePath(Module.java:60)
com.tns.Runtime.runModule(Native Method)
com.tns.Runtime.runModule(Runtime.java:580)
com.tns.Runtime.run(Runtime.java:574)
com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:17)
android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
android.app.ActivityThread.-wrap1(ActivityThread.java)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
android.os.Handler.dispatchMessage(Handler.java:102)
android.os.Looper.loop(Looper.java:148)
android.app.ActivityThread.main(ActivityThread.java:5417)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
File: "<unknown>, line: 1, column: 265
I've followed your tutorial in your README on how to include AWSCognito:
require('nativescript-nodeify');
let AmazonCognitoIdentity = require('amazon-cognito-identity-js');
and here's my package.json:
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.chspatientapp",
"nodeify": {
"package-dependencies": {
"aws-sdk": [
{
"xml/browser_parser": "xml/node_parser"
}
]
}
},
"tns-android": {
"version": "2.5.0"
},
"tns-ios": {
"version": "2.5.0"
}
},
"dependencies": {
"@angular/common": "2.3.1",
"@angular/compiler": "2.3.1",
"@angular/core": "2.3.1",
"@angular/forms": "2.3.1",
"@angular/http": "2.3.1",
"@angular/platform-browser": "2.3.1",
"@angular/platform-browser-dynamic": "2.3.1",
"@angular/router": "3.3.1",
"amazon-cognito-identity-js": "^1.16.0",
"moment": "^2.17.1",
"nativescript-angular": "1.3.0",
"nativescript-bluetooth": "^1.1.4",
"nativescript-local-notifications": "^1.2.1",
"nativescript-nodeify": "^0.5.5",
"nativescript-oauth": "^1.2.1",
"nativescript-theme-core": "^0.2.1",
"reflect-metadata": "~0.1.8",
"rxjs": "5.0.0-rc.4",
"tns-core-modules": "^2.5.0"
},
"devDependencies": {
"babel-traverse": "6.21.0",
"babel-types": "6.21.0",
"babylon": "6.15.0",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0.*.*",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "~2.0.10",
"zone.js": "~0.7.2"
}
}
running: Node v6.9.4 {N} v2.5.0
Kind of at a loss here. Any help would be greatly appreciated.
Try using: npm i os --save
Any progress on this one? Receiving the same error when trying to install aws-sdk.
file:///app/tns_modules/aws-sdk/lib/shared_ini.js:2:17: JS ERROR Error: Could not find module 'os'.
os is a native node module and shouldn't be installed with npm.
It seems adding the following line to the file shims.json in nativescript-nodeify foder can fix the error
"os": "nativescript-nodeify/empty.js"
Can this line be added to the github repo?
npm i os --save
Thanks! It did work. Once again thanks a lot
npm i os --save