-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[4.2 beta]: Cannot read properties of undefined (reading 'push') #12960
Comments
We've also run into this problem. When can we expect a stable release of Strapi 4.2? |
I am also getting an error related to I followed this to setup unit testing. I encountered this error:
I'm using strapi version 4.2.0-beta.0 |
@blankart Are you using TypeScript by any chance? I've run into this exact same issue and it's related to how Strapi loads the APIs, routes etc. strapi/packages/core/strapi/lib/Strapi.js Lines 47 to 58 in 48ab30c
I've had this issue when Strapi was not able to load routes / controllers / middleware etc. due to searching in the wrong folder (the TS The following snippets loads the respective files. It can only handle strapi/packages/core/strapi/lib/core/loaders/apis.js Lines 153 to 164 in 3e30831
|
This issue doesn't seem to be present in the current latest release of Strapi |
@Bassel17 I'd like to re-open with
FYI: I migrated this existing project to Typescript |
Im not sure why but to me this error appears when adding |
Scratch that, my build removed the tsconfig.json file (as part of a 'clean build'), which seems is needed to determine if it's a TS project or not. Wouldn't it just be easier to check for a |
@roelbeerens the |
@sjoukedv I would want to know more information about this, I wasn't able to reproduce this. |
I believe I ended up adding a debug FYI: I am on Ubuntu 20.04 |
Antixrist is correct, it's the same issue (well, solution) as the above linked issue. It can be fixed in my case (on windows, strapi 4.4.0) by changing these lines in the strapi package: In @strapi/typescript-utils/lib/utils/get-config-path.js. Comment out the return line on line 33 and replace with the following lines (line 33 included for reference). // return configFilePath.startsWith(dirAbsolutePath) ? configFilePath : undefined;
const configFileAbsolutePath = path.resolve(configFilePath)
return configFileAbsolutePath.startsWith(dirAbsolutePath)
? configFileAbsolutePath
: undefined |
I cannot find solution to this error npm ERR! A complete log of this run can be found in: |
My bad for not replying earlier, seems like my Github notification settings are all messed up. Anyways, you are right about the It's totally not a big deal to keep the |
Resolve this
For me issue resolved by passing distDir in options
|
Can we add this fix in to the testing documentation?
That and the fact that non-default environment config files need to be |
When i tried this method in starpi 4.20.0 (typescript) I got following error
For me this works !
|
Describe the Bug
When using the
4.2.0-beta.0
withtypescript
, when I run a production build and then try to start my application, I get the following error:This is the code the error is thrown on:
Here are the files of my collection.
There has been no customization to these
Required System information
Expected behavior
Strapi to start correctly
The text was updated successfully, but these errors were encountered: