Open efgonz opened 7 years ago
Same error for me: I started a new project from Nativescript Groceries (Angular) on Windows 10. Followed the step by step procedure to install nativescript-nodeify and AWS Cognito identity.
First build was ok (with just the template code untouched) As soon as I put:
require('nativescript-nodeify'); var AmazonCognitoIdentity = require('amazon-cognito-identity-js');
the app just broke. If I try:
tns run android
I get: Searching for devices... Executing before-liveSync hook from S:\myfolder\hooks\before-liveSync\nativescript-angular-sync.js Executing before-prepare hook from S:\myfolder\hooks\before-prepare\nativescript-dev-typescript.js Found peer TypeScript 2.3.4 Executing before-prepare hook from S:\myfolder\hooks\before-prepare\nativescript-nodeify.js Unable to apply changes on device: 04157df4e4ed5637. Error is: Cannot find module 'file-system/file-system-access'.
Here is my package.json file:
{
"name": "MyApp",
"version": "1.0.0",
"description": "Bla bla",
"keywords": [
"Psoriasi"
],
"author": "gepisolo",
"license": "MIT",
"nativescript": {
"id": "org.nativescript.psooooapp",
"tns-android": {
"version": "3.1.1"
},
"tns-ios": {
"version": "3.1.0"
},
"nodeify": {
"package-dependencies": {
"aws-sdk": [
{
"xml/browser_parser": "xml/node_parser"
}
]
}
}
},
"scripts": {
"tslint": "tslint -p tsconfig.json",
"ns-bundle": "ns-bundle",
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
"start-android-bundle": "npm run ns-bundle --android --run-app",
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
"build-android-bundle": "npm run ns-bundle --android --build-app",
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
},
"dependencies": {
"@angular/common": "~4.2.3",
"@angular/compiler": "~4.2.3",
"@angular/core": "~4.2.3",
"@angular/forms": "~4.2.3",
"@angular/http": "~4.2.3",
"@angular/platform-browser": "~4.2.3",
"@angular/router": "~4.2.3",
"amazon-cognito-identity-js": "^1.20.0",
"email-validator": "^1.0.7",
"jsonwebtoken": "^8.0.1",
"nativescript-angular": "next",
"nativescript-iqkeyboardmanager": "1.0.1",
"nativescript-nodeify": "^0.5.5",
"nativescript-social-share": "~1.3.2",
"nativescript-unit-test-runner": "^0.3.3",
"node-uuid": "^1.4.8",
"reflect-metadata": "^0.1.8",
"rxjs": "^5.4.0",
"tns-core-modules": "next",
"zone.js": "^0.8.11"
},
"devDependencies": {
"@angular/compiler-cli": "~4.2.3",
"@ngtools/webpack": "~1.5.3",
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.0",
"codelyzer": "^3.0.1",
"copy-webpack-plugin": "~4.0.1",
"extract-text-webpack-plugin": "~3.0.0",
"filewalker": "^0.1.3",
"jasmine-core": "^2.6.2",
"karma": "^1.7.0",
"karma-jasmine": "^1.0.2",
"karma-nativescript-launcher": "^0.4.0",
"lazy": "1.0.11",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-typescript": "^0.4.5",
"nativescript-dev-webpack": "next",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.1.0",
"tslint": "^5.4.2",
"typescript": "~2.3.4",
"webpack": "~3.2.0",
"webpack-bundle-analyzer": "^2.8.2",
"webpack-sources": "~1.0.1",
"nativescript-worker-loader": "~0.8.1"
}
}
@EddyVerbruggen I got the same error using your nativescript-plugin-firebase plugin. It turns out that the error is caused by the firebase plugin using fs-extra in its prepare scripts. Replacing fs-extra with fs fixed it for me. What do you think would be the best solution? Replacing fs-extra or changing nodeify to support fs-extra?
I was seeing a very similar issue every time I tried to use Babel (via tns android prepare
). I believe it is related to #29.
@EddyVerbruggen Hi, after investigation, I believe this problem was originated due to the fact that node-sass require fs and nativescript-nodeify did not filter out node.js environment situation.
solution can be made by simply ignore node.js environment when triggering the injection.
Hi, that sounds reasonable - would you be willing to do a PR perhaps?
I'm having the same issue and I'm using the firebase plugin too, however the prepare scripts seem to require 'fs' not 'fs-extra' - any other thoughts ?
Error is: Cannot find module 'file-system/file-system-access'.
Reinstall node_modules and add platforms again does not solve the problem