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

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+.

Related

ng build --prod - Error: Property body expected type of array but got null

I recently made a new branch in my angular project and am working on in for a bit. Now I wanted to build it for testing on smartphones. When using ng build --prod, I get the following error (ng build works tho!)
An unhandled exception occurred:
/Users/r/Documents/.../project/main-es2015.23a6f948094203a25f4a.js:
Property body expected type of array but got null See
"/private/var/folders/c5/y_n4tj316sq9x1nqx20qdlh40000gp/T/ng-FBFvv4/angular-errors.log"
for further details.
The angular-errors.log is not helpfull at all:
[error] TypeError:
/Users/r/Documents/.../project/main-es2015.23a6f948094203a25f4a.js:
Property body expected type of array but got null
at validate (/Users/r/Documents/.../project/node_modules/#babel/types/lib/definitions/utils.js:160:13)
at Object.validate (/Users/r/Documents/.../project/node_modules/#babel/types/lib/definitions/utils.js:229:7)
at validateField (/Users/r/Documents/.../project/node_modules/#babel/types/lib/validators/validate.js:24:9)
at Object.validate (/Users/r/Documents/.../project/node_modules/#babel/types/lib/validators/validate.js:17:3)
at NodePath._replaceWith (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/replacement.js:172:7)
at NodePath._remove (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/removal.js:57:10)
at NodePath.remove (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/removal.js:36:8)
at PluginPass.ForOfStatement (/Users/r/Documents/.../project/node_modules/#babel/plugin-transform-for-of/lib/index.js:206:16)
at newFn (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/visitors.js:175:21)
at NodePath._call (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/context.js:55:20)
at NodePath.call (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/context.js:42:17)
at NodePath.visit (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/path/context.js:92:31)
at TraversalContext.visitQueue (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/context.js:116:16)
at TraversalContext.visitSingle (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/context.js:88:19)
at TraversalContext.visit (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/context.js:144:19)
at Function.traverse.node (/Users/r/Documents/.../project/node_modules/#babel/traverse/lib/index.js:82:17)
Production Environment.prod.ts looks like this:
export const environment = {
production: true,
VERSION: require('../../package.json').version
};
I tried using the --source-map=true flag, but it is canceling building before its able to write the sourcemap.
I didnt put hands on my package.json since two month, but also tried deleting the node_modules and reinstall them.
I also tried changing rxjs and typescript versions, but no success
Im using angular -v 10.1.6, typescript -v 4.0.3, rxjs -v 6.4.5
What can I do??
Any help appreaciated!
I found a solution here https://github.com/angular/angular-cli/issues/16998.
My problem was using Labels. It appears that babel is having a bug with that.

Google Cloud TypeError: Cannot read property 'Reader' of undefined

My Google Cloud Function won't upload if I include this line, which came from the docs:
const {Translate} = require('#google-cloud/translate').v2;
The error is
TypeError: Cannot read property 'Reader' of undefined
There's no Reader in my code.
My version is:
npm -v #google-cloud/translate
6.14.10
Which is odd, because the current npm version is 6.0.5, and the release notes say there hasn't been an update since March 2020.
I tried both Node 10 and Node 12 for the Firebase Cloud Functions engine, same error.
Am I getting this error because I'm on the event horizon of a black hole and downloaded a future version of #google-cloud/translate? I think I might be in an alternative universe, 2020 was awful. How are things in your universe?
I updated the npm modules in my /functions directory and the error message is gone. Both firebase-functions and #google-cloud/translate were out of date.

Error in generating signed apk

I am getting an error while trying to generate a signed apk for my ionic application. I followed the steps from https://developer.android.com/studio/publish/app-signing.html.
Below is the error image:
Can someone tell the root cause behind this error.
I had this issue literally yesterday. I believe there has been an update to Google Messaging Service (GMS). Are you using the plugin Background Geolocation cordova-background-geolocation OR PushWoosh plugin (pushwoosh-cordova-plugin)?
I have not received a permanent fix (I believe the guys in charge need to update their plugin), but a temporary fix is to navigate to {projectname}-build.gradle.
You should see a line along the following lines:
dependencies {
compile 'com.google.android.gms:play-services-location:11.+'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile(name:'tslocationmanager', ext:'aar')
// logback-android
compile 'org.slf4j:slf4j-api:1.7.21'
compile 'com.github.tony19:logback-android-core:1.1.1-6'
compile('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}
}
Change the top line so instead of 11+, it becomes 11.2.0.
If not, comment which plugins you are using please.
Alternatively
I found a new plugin today which can be used precisely for this, cordova-google-api-version: https://www.npmjs.com/package/cordova-google-api-version.
You can install it by running the following:
cordova plugin add cordova-google-api-version#latest --save

Ember CLI: Attempting to register an unknown factory: `controller:object`

My ember-cli version is 0.2.3. I am getting the following error when I try to run tests.
TypeError: Attempting to register an unknown factory: `controller:object`
at Object.Registry.register (http://localhost:7357/assets/vendor.js:12208:15)
at Object.container.(anonymous function) [as register] (http://localhost:7357/assets/test-support.js:1905:44)
at Object.isolatedContainer [as default] (http://localhost:7357/assets/test-support.js:1946:15)
at exports.default.klassy.Klass.extend._setupIsolatedContainer (http://localhost:7357/assets/test-support.js:2406:52)
at exports.default.klassy.Klass.extend.setupContainer (http://localhost:7357/assets/test-support.js:2312:14)
at nextStep (http://localhost:7357/assets/test-support.js:2300:53)
at exports.default.klassy.Klass.extend.invokeSteps (http://localhost:7357/assets/test-support.js:2305:14)
at exports.default.klassy.Klass.extend.setup (http://localhost:7357/assets/test-support.js:2275:19)
at Object.qunit.module.setup (http://localhost:7357/assets/test-support.js:1814:16)
at runHook (http://localhost:7357/assets/test-support.js:3534:20)
Any idea on what might be causing this? Looking like a ember-cli internal issue.
I am actually using v2.3.0-beta.2 of Ember CLI. When you fire it up, it displays v0.2.3 on terminal for some reason.
Ember version is 2.0.
I have a unit test for a model that triggers this. The test is using moduleFor rather than moduleForModel as my app doesn't use Ember Data.
I am actually using v2.3.0-beta.2 of Ember CLI. When you fire it up, it displays v0.2.3 on terminal for some reason.
This happens because your globally installed Ember CLI is different from the version specified in the project's package.json.
What Ember CLI does when you run a command if check if it's inside an Ember project. It does this by checking for a package.json file in the current, or parent, directory. If it finds it, it will then delegate the command to the Ember CLI that your project depends on.
This is done to make sure that the commands (generate, build, etc) called are the right version and won't break your application.

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

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?