so I am trying to add redux to NS project (specially the Groceries example)
I use the same code that works fine in the browser but in NateScript I get a non specific error of:
JS: Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
JS: EXCEPTION: Uncaught (in promise): Error: Error in ./LoginComponent class LoginComponent_Host - inline template:0:0 caused by: process is not defined
JS: ORIGINAL STACKTRACE:
JS: Error: Uncaught (in promise): Error: Error in ./LoginComponent class LoginComponent_Host - inline template:0:0 caused by: process is not defined
JS: at resolvePromise (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:416:31)
JS: at /data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:393:13
JS: at ZoneDelegate.invoke (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:190:28)
JS: at Object.NgZoneImpl.inner.inner.fork.onInvoke (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:6158:41)
JS: at ZoneDelegate.invoke (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:189:34)
JS: at Zone.run (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:83:43)
JS: at /data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:449:57
JS: at ZoneDelegate.invokeTask (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:223:37)
JS: at Object.NgZoneImpl.inner.inner.fork.onInvokeTask (/data/data/org.nativescript.groceries/files/app/tns_modules/@angular/core/bundles/core.umd.js:6149:41)
JS: at ZoneDelegate.invokeTask (/data/data/org.nativescript.groceries/files/app/tns_modules/nativescript-angular/zone.js/dist/zone-nativescript.js:222:42)
JS: Unhandled Promise rejection: Error in ./LoginComponent class LoginComponent_Host - inline template:0:0 caused by: process is not defined ; Zone: angular ; Task: Promise.then ; Value: Error: Error in ./LoginComponent class LoginComponent_Host - inline template:0:0 caused by: process is not defined ReferenceError: process is not defined
I spent a day and a half on this and I am sorry to say I gave up.
with the limited amount of info I get from the stacktrace I simply don't know what else to try.
I would really appreciate if someone can assist.
the project is here:
https://github.com/born2net/sample-Groceries
I set the store here:
https://github.com/born2net/sample-Groceries/blob/master/app/app.module.ts
and use it here:
https://github.com/born2net/sample-Groceries/blob/master/app/login/login.component.ts
again works fine in browser but not in NativeScript,
tx for any help
regards
Sean
related to issue #2939
thanks, I have two days at this and frustrated by the fact I get very little help from the community and even more so VERY little help from stack traces...
I would greatly appreciare it if anyone from the NativeScript team would create a SIMPLE angular 2 NS project that just has:
If NS is to be a success, this would be a minimum requirement,
I am by no means a novice,
you can see some of my projects:
Angular 2 Kitchen sink: http://ng2.javascriptninja.io
and source@ https://github.com/born2net/Angular-kitchen-sink
https://github.com/born2net/studioDashboard
I can help the community of NativeScript greatly, but need to get basic assistance in getting a redux store in place!
Regards,
Sean
Hi I tried to use Redux (the library) along with the ng2-redux. ng2-redux actually depends on redux and adds additional angular2 integration to ease development.
I hit exactly the same problem with the process and managed to work-around it by adding
global.process = { env: {} }
in my main.ts just before all the imports. I will try to apply the same approach in you repo to see if it works. I will also post the example I did for reference.
tx... dude, I've been to the end of the web and back, tried ng2-redux, tried simpel non ts version from https://github.com/vicentedealencar/nativescript-with-redux and ton of other stuff.... the worst part is that you got no real stack traces, so I am like... ok now what :/
I am going to try the global.process = { env: {}} now :)
if you try an app for me, PLEASE make sure you use
const reducers = combineReducers({reducerList});
const middlewareEnhancer = applyMiddleware(<any>thunkMiddleware);
const enhancers = compose(middlewareEnhancer);
const createStoreWithEnhancers = enhancers(createStore);
const reduxAppStore = createStoreWithEnhancers(reducerList);
TX again!!!!!!
WOW, that did it... I have no idea why we needed global.process = { env: {} } but things are starting to work!!! TX AGAIN!!!
closed!!!
tx so much!!!!
Great to hear you managed!
The root of all evil is this check which fails. Good news is that the redux code in master branch is better guarded, so probably the need for global.process = ... patch will go away.
I have uploaded the ng2-redux example just for reference:
https://github.com/vakrilov/ng2-redux-nativescript
GREAT tx again!!!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi I tried to use Redux (the library) along with the ng2-redux. ng2-redux actually depends on redux and adds additional angular2 integration to ease development.
I hit exactly the same problem with the process and managed to work-around it by adding
in my
main.tsjust before all the imports. I will try to apply the same approach in you repo to see if it works. I will also post the example I did for reference.