getCustomRepository returns a repository object with `this` being undefined when entities and repositories come from an npm package - orm

I've moved my TypeORM entities, migrations and repositories to a shared npm package.
When using this package I'm trying to do const repo = getCustomRepository(MyRepo)
However, it appears that the repo has this as undefined. And I'm getting errors like TypeError: Cannot read properties of undefined (reading 'find').
Basically the same issue as in this Reddit thread: https://www.reddit.com/r/typescript/comments/p8932l/this_is_undefined_on_typeorm_custom_repository/
I'm not using NestJS in my case.
Does someone have a clue about what's going on and how to make it work?

Related

Error with the dependency of a dependency in nodejs

I have forked a repo to here:
https://github.com/unegma/react-three-fpscontrols
and am trying to convert the package to use typescript..
The error I keep getting is:
TypeError: three_1.Vector3 is not a constructor
which is occurring on this line here:
https://github.com/unegma/react-three-fpscontrols/blob/c89176ab5ce71e8e89332c088047ff85f804306e/src/FPSControls.tsx#L11
Checking the 'three' object in my console shows this: /static/media/three.c679b86df6ce78a00d67.cjs
instead of an Object containing Vector3, which leads me to think I'm doing the import of the import incorrectly.
I've tried including the #types/three in the dev dependencies, and the dependencies, and the peer dependencies, but nothing seems to work. Any clues?

Setting up SharePoint 1.16.1 Web Part with Vue3. Get error TypeError: Cannot read properties of undefined (reading 'NormalModule') after gulp serve

I want to set up a project using SharePoint 1.16.1 and Vue3. I am using vue-loader and vue-class-coponent as well other packages. Whenever I tried to run gulp serve I get the error message 'TypeError: Cannot read properties of undefined (reading 'NormalModule').'
I had set up the project using yo #microsoft/sharepoint and following the commands using No JavaScript framework.
Error Message:
[10:49:11] Error - [webpack] TypeError: Cannot read properties of undefined (reading 'NormalModule')
[10:49:11] Error - 'webpack' sub task errored after 363 ms
Cannot read properties of undefined (reading 'NormalModule')
I tried installing a later version of webpack, but that did not work as webpack is a core dependency of vue-loader. Considering that that is where one of the issues lie, how do I fix it?

lerna bootstrap info undefined#undefined~postinstall: undefined#undefined

I have 3 repositry, react components, ts utils and react app, when I use lerna to manage them, it happens. I'm not very familiar with lerna, I want to know why it hapeened and how can I solve it.
learn repo issue has no problem like this
Add "name" property to package.json.
Same Issue is here.
"npm ci" throws exception: Cannot read property 'length' of undefined

Nuxt generate ERROR Cannot read property '__esModule' of undefined

When I run nuxt generate on my project it generates this error several times:
ERROR Cannot read property '__esModule' of undefined 11:09:43
at ensureCtor (node_modules/vue/dist/vue.runtime.common.js:2262:10)
at node_modules/vue/dist/vue.runtime.common.js:2317:26
at node_modules/vue/dist/vue.runtime.common.js:324:10
at process._tickCallback (internal/process/next_tick.js:68:7)
I would report it as a bug but I failed to reproduce it outside of my closed-source project. I'm also not sure if it's an issue with Vue or Nuxt, might even be both.
The error seems to be related to using async components which I do use. The line causing the error is in an async component resolver: https://github.com/vuejs/vue/blob/dev/src/core/vdom/helpers/resolve-async-component.js#L18
My project has other configurations too that don't use async components and are not having this issue.
What I would like to know is how it might be possible to avoid these errors and still use async components.

Express.js using passport-facebook - TypeError: Object 302 has no method 'indexOf'

I've got an express project already running, I'm just trying to hook it up using passport to authenticate through facebook, I've basically copied the example from the github page here:
https://github.com/jaredhanson/passport-facebook
But I'm getting the following error whenever I try to go to the '/auth/facebook' URL in my app:
TypeError: Object 302 has no method 'indexOf'
at ServerResponse.res.redirect (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/express/lib/response.js:546:13)
at Strategy.strategy.redirect (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/passport/lib/middleware/authenticate.js:294:15)
at Strategy.OAuth2Strategy.authenticate (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/passport-facebook/node_modules/passport-oauth2/lib/strategy.js:227:10)
at Strategy.authenticate (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/passport-facebook/lib/strategy.js:84:41)
at attempt (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/passport/lib/middleware/authenticate.js:337:16)
at authenticate (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/passport/lib/middleware/authenticate.js:338:7)
at callbacks (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/express/lib/router/index.js:171:11)
at param (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/express/lib/router/index.js:145:11)
at pass (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/express/lib/router/index.js:152:5)
at Router._dispatch (/Users/jlawrence/Documents/Websites/Node/Gigster/node_modules/express/lib/router/index.js:179:5)
It could be an incompatibility with older versions of express; you might try updating to express#3.5.x; 3.6 and above deprecated some methods and the refactor might not be worth it.
Try npm install express#3.5.x, or npm install express#3.5.x -g if it's a global package. Make sure to update the package.json file too.