Ember pre-render: TypeError: 'undefined' is not a function (evaluating 'u.bind(e)') - ember.js

I am trying to create a pre-render server for my ember app.
I installed ember-prerender (https://github.com/zipfworks/ember-prerender), used the initializers provided in the /example, deployed it on one of my servers.
But when I try to launch it:
[Renderer 0] Engine starting up (phantom)
[Renderer 0] Restarting rendering engine in 25000 seconds after it failed
with error: Phantom encountered an error: TypeError:
'undefined' is not a function (evaluating 'u.bind(e)')
I'm unsure where to look. I tried:
Deleting all third-party SDK (Facebook, Google Analytics)
Logging different parts of the code (the event XContentReady seems to be fired)
Launching with the engine jsdom instead of phantom (gives: [Renderer 0] Restarting renderer, timed out while initializing)
Trying in production
I don't know where too look at now. The worse part is that I had it working a few days ago (see: Ember pre-render: timed out while initializing)
EDIT:
I don't think that the problem has anything to do with the code, since I did a hard reset to a version that used to work.
Maybe some version changed (bower, npm, phantom)? I tried to update bower to 1.6, no success.
Maybe I have new dependencies that cause the problem? I don't see exactly how though
EDIT2: I started fresh on a new server, now I get Phantom crashing with this error message:
[Renderer 0] Restarting rendering engine in 25000 seconds
after it failed with error: Erroneous exit code: null SIGSEGV
If I use JSDOM I still get the Restarting renderer, timed out while initializing
EDIT 3: I tried to include a polyfill in my app. Using:
github.com/es-shims/es5-shim
then as an addon: github.com/pixelhandler/ember-cli-es5-shim
With no success
EDIT 4: I'm having the same error with a brand new project, containing only ember-prerender, so I'm thinking it's either linked to my particular build (version: 1.13.13, node: 0.12.3, npm: 2.14.10, os: linux x64), or my computer packages/configuration.

I don't have experience with jsdom, but Function.prototype.bind is not supported with phantomjs#1.9 and lower. Have you tried phantomjs#2.0?

Related

New Ember project: The "data" argument must be of type string or an instance

I used the cli to create a new Ember project (v2.18). I'm getting the following error when I try to build/serve the project. This is with 100% clean project, no edits yet. Also fwiw, am using node v14.19.3, npm v6.14.17.
- stack: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at Object.writeFileSync (fs.js:1522:5)
at module.exports (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/utilities/attempt-never-index.js:26:6)
at Builder.build (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/models/builder.js:156:5)
at BuildTask.run (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/tasks/build.js:29:20)
at /Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/lib/models/command.js:243:46
at tryCatcher (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:326:21)
at invokeCallback (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:498:33)
at /Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:562:16
at flush (/Users/nikoleizinsli/IdeaProjects/custom-fields-admin/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:2441:7)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
UPDATE: I was able to get it to build by using Node v13. We have another Ember 2.18 project that compiles fine on Node v14...so not sure what is causing this.
Any reason you're using that version of Ember? It stopped getting updates in 2018. I'd guess this is an issue with Node 14, you may need to go back to Node 10 to get support for ember-cli 2.18. Or, even better, run npm install -g ember-cli to get the 4.4 version which supports Node 14+.

Metro Bundler fails while trying to resolve module `immer` from redux-toolkit

I'm building a react native app using Expo and Expo Go to test it on an android device. It has been working flawlessly until today. I encoutered an error on one of my components with this kind of error:
Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)' on a null object reference
Solution seemed to me to clear cache yarn cache clean. I also cleared cache on the Expo Go app. But this led me to Metro Bundler failing with this error:
Android Bundling failed 1279ms
While trying to resolve module `immer` from file `H:\my_project\app\node_modules\#reduxjs\toolkit\dist\redux-toolkit.cjs.production.min.js`, the package `H:\my_project\app\node_modules\immer\package.json` was successfully found. However, this package itself specifies a `main` module field that could not be resolved (`H:\my_project\app\node_modules\immer\dist\immer.esm.mjs`. Indeed, none of these files exist:
* H:\my_project\app\node_modules\immer\dist\immer.esm.mjs(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
* H:\my_project\app\node_modules\immer\dist\immer.esm.mjs\index(.native|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json)
When checking H:\my_project\app\node_modules\immer\dist\, I do find an immer.esm.mjs file but no H:\my_project\app\node_modules\immer\dist\immer.esm.mjs\ folder with an index file in it.
So I tried to manually remove node_modules/ and reinstall packages with yarn, restart the Expo server, doing all this after restarting my machine, even ran expo upgrade, removed .expo/, removed yarn.lock, but I keep getting the same error.
This leaves me quite confused. Thank you for your suggestions on what to do.
Here are the dependencies versions used as in my package.json:
"#reduxjs/toolkit": "^1.8.1",
"#types/react-redux": "^7.1.22",
"expo": "~45.0.0",
"react": "17.0.2",
"react-native": "0.68.2",
"react-redux": "8.0.1",
"redux": "4.2.0"
Fix
As suggested in this redux-toolkit issue, there seems to be an issue with immer version 9.0.13. Temporary fix suggested there is working for me, adding immer#9.0.12 to my resolutions in packages.json:
"resolutions": {
"immer": "9.0.12"
}
Update
This PR on immer resolved this issue (9.0.14). I can confirm the above fix isn't needed anymore on my side. Looks like my bad luck came from some breaking changes being pushed on a minor release.

Virtualbox - Tails - failed to open disk image file

Host machine: OSX Mojave
Virtualbox: 6.0.4
Tails: 3.12
Where I download virtualbox: brew cask install virtualbox. NOTE: I had virutalbox installed quite awhile and using it with vagrant and ansible to test playbook and stuff, and did make sure everything was clean when trying to run tails.
Where I download the image file: from tails site download using torrent
How I attempted to run tails from ISO image in virtual box: steps follow from tails documentation, it was straightforward and tried it more than five times
Error occurred at: steps 7, from the tails doc at configuring virtual machine to start from an ISO image, and below are the detail error:
The medium '/my-path/tails-amd64-3.12.iso'
can't be used as the requested device type.
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: MediumWrap
Interface: IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}
Callee: IVirtualBox {d0a0163f-e254-4e5b-a1f2-011cf991c38d}
Callee RC: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)
Expectation: No error popup at steps 7, which at the adding tails ISO image, and the rest of the step and could successfully start tails up
Attemps to get it work:
Attempt one: I watched one video from youtube that was about 7 months ago running tails in virtualbox, the process was pretty straightforward but I still get the same error.
Attemp two: I googled about the issue and only found simliar error. Those are conflicting Disk ID, which I applied the solution but got no luck.
I don't really use virtualbox much so are there anyway I can know more about the error message or anyone knows how to do with this? Thanks beforehand and appreciate for your precious time and help.
It is working now, the weird thing is that I have to directly open the .iso image instead of clicking on the folder that contains the .iso.

omcljs basic tutorial giving error: Uncaught Error: Assert failed: No target specified to om.core/root (not (nil? target))

I am attempting om's basic tutorial, and run into an error even before changing any code.
I followed the instructions, running lein new figwheel om-tut -- --om, cd om-tut, and lein figwheel.
http://localhost:3449/ then displays the html text, not the app-state text which it should be displaying instead. Furthermore, when I open my dev tools to the console I see the error message shown in the following screenshot.
This is unexpected because I have not changed the tutorial at all, just downloaded and run following the instructions to a T. It is also unexpected because the tutorial seemed to work for me just yesterday, running on my same machine.
Any one know what could be the issue?
This is a really old bug in the om.root https://github.com/swannodette/mies-om/issues/2. It should have been fixed by now.

Grunt crashing after warning "unexpected end of input" on expressServer task - OS X Yosemite, Ember App Kit

I was away from our Rails + Ember project, and didn't realize that my local environment had totally broken with upgrade to OS X Yosemite. A number of steps were remedied (e.g. fixing /usr/local/ permissions for homebrew or getting an earlier version of Phantomjs) - but now I've been stuck with Grunt for a few days and need help.
Stack:
Ember app kit on the front-end, rails on the backend.
Problem:
running grunt server, I get a warning as such:
...
Done, without errors.
Running "expressServer:debug" (expressServer) task
Warning: Unexpected end of input Use --force to continue.
Aborted due to warnings.
Running it with --verbose flag doesn't shed any light at all, exactly the same error.
Using --force flag, it appears to continue - but doesn't actually serve the app.
Relevant task from Gruntfile.js:
Actually, default that came from EAK:
grunt.registerTask('server', "Run your server in development mode, auto-rebuilding when files change.", function(proxyMethod) {
var expressServerTask = 'expressServer:debug';
if (proxyMethod) {
expressServerTask += ':' + proxyMethod;
}
grunt.task.run(['clean:debug',
'build:debug',
expressServerTask,
'watch'
]);
});
Now I'm totally at loss how to debug it further. Excessive googling didn't help me, there are no logs to look at, and the error message isn't guiding me :-(
Any ideas how I could make grunt server actually serve my app?
The error is stating that a curly brace is not closed. I would assume that a bower install has been interrupted or failed. Try clearing the bower cache (bower cache clean) then bower update.