Skip to content
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

Versioning plugin TypeError: Cannot read property 'listContentTypes' of undefined #47

Closed
AlexZCP opened this issue Apr 9, 2021 · 17 comments · May be fixed by #53
Closed

Versioning plugin TypeError: Cannot read property 'listContentTypes' of undefined #47

AlexZCP opened this issue Apr 9, 2021 · 17 comments · May be fixed by #53
Assignees
Labels
bug Something isn't working investigation Issue under investigation waiting for feedback Waiting for reported feedback

Comments

@AlexZCP
Copy link

AlexZCP commented Apr 9, 2021

Hi!

Stable STRAPi version: 3.5.4
Trying to install strapi-plugin-versioning from this package (https://www.npmjs.com/package/strapi-plugin-versioning),
I'm doing due to instruction on package page.

  1. run install
  2. create config/middleware.js.
  3. copy node_modules/strapi-versioning-plugin/extensions to ./extensions
  4. run build

After when I tried to start strapi i received:
error TypeError: Cannot read property 'listContentTypes' of undefined

I understand that it might be cause new version of Strapi.
Can smb please help how to fix it?

@cyp3rius
Copy link
Collaborator

cyp3rius commented Apr 9, 2021

Hi @AlexZCP,

Try to repeat please point 3 but with copying files directly from the repository. We're trying to change the way it's packed to node_modules as you're not the first one that recognizes this issue.

@cyp3rius cyp3rius added bug Something isn't working investigation Issue under investigation waiting for feedback Waiting for reported feedback labels Apr 9, 2021
@AlexZCP
Copy link
Author

AlexZCP commented Apr 9, 2021

Thank you for the answer, @cyp3rius

The difference between extensions/content-manager from this repository (https://github.com/VirtusLab/strapi-molecules) and npm version that last one missed admin/src folder inside.

I copied content-manager dir fully to ./extensions
And now I've got error during build step:

Error: Module not found: Error: Can't resolve './reducer' in `path-to-strapi\.cache\plugins\strapi-plugin-content-manager\admin\src\containers\EditView'
    at path-to-strapi\node_modules\strapi-admin\index.js:71:23
...

@AlexZCP
Copy link
Author

AlexZCP commented Apr 13, 2021

Can anyone else tell me, what I'm doing wrong?

@joelamltc
Copy link

joelamltc commented May 12, 2021

I cannot be able to use this plugin as well. Here is what I did so far. I am using Strapi v3.6

  1. create config/middleware.js.
  2. copy strapi-versioning-plugin/extensions to ./extensions (using github version)
    Nothing working, and
[2021-05-12T11:00:44.969Z] debug ⛔️ Server wasn't able to start properly.
[2021-05-12T11:00:44.970Z] error TypeError: Cannot read property 'listEntityVersions' of undefined
    at routerChecker (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/router/utils/routerChecker.js:36:33)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/router/utils/composeEndpoint.js:15:52
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/router/index.js:52:13
    at Array.forEach (<anonymous>)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/router/index.js:50:40
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/lodash/lodash.js:4967:15
    at baseForOwn (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/lodash/lodash.js:3032:24)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/lodash/lodash.js:4936:18
    at Function.forEach (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/lodash/lodash.js:9410:14)
    at Object.initialize (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/router/index.js:45:11)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/middlewares/index.js:53:28
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I tried so many things like moving the services folder into the extensions/content-manager folder as well. However, no luck with me.

[2021-05-12T11:08:28.079Z] debug ⛔️ Server wasn't able to start properly.
[2021-05-12T11:08:28.080Z] error /Users/joelam/Documents/ubuntu/strapi-cms/extensions/content-manager/services/create-versions-table.js:3
import * as Knex from "knex";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (internal/modules/cjs/loader.js:984:16)
    at Module._compile (internal/modules/cjs/loader.js:1032:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
    at Module.load (internal/modules/cjs/loader.js:933:32)
    at Function.Module._load (internal/modules/cjs/loader.js:774:14)
    at Module.require (internal/modules/cjs/loader.js:957:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at loadFiles (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/load/load-files.js:37:13)
    at async module.exports (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi/lib/core/load-extensions.js:23:34)
    at async Promise.all (index 5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I am also having the same issues as @AlexZCP stated.

$ strapi build
Building your admin UI with development configuration ...

● Webpack █████████████████████████ building (68%) 2078/2128 modules 50 active
 babel-loader › .cache/plugins/strapi-plugin-content-manager/admin/src/containers/ListView/Filter.js

Error: Module not found: Error: Can't resolve './reducer' in '/Users/joelam/Documents/ubuntu/strapi-cms/.cache/plugins/strapi-plugin-content-manager/admin/src/containers/EditView'
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/strapi-admin/index.js:71:23
    at finalCallback (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compiler.js:257:39)
    at onCompiled (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compiler.js:265:20)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compiler.js:670:21
    at eval (eval at create (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:28:1)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compilation.js:1173:13
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compilation.js:1096:25
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compilation.js:1017:13
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2830:7
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2830:7
    at done (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2863:11)
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2818:7
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/webpack/lib/Compilation.js:1017:13
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2830:7
    at /Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2830:7
    at done (/Users/joelam/Documents/ubuntu/strapi-cms/node_modules/neo-async/async.js:2863:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Can anyone help on this point?

@cyp3rius
Copy link
Collaborator

@Kronos66 may you please look on it?

@Kronos66 Kronos66 linked a pull request May 23, 2021 that will close this issue
@Kronos66
Copy link
Collaborator

Kronos66 commented May 23, 2021

Hi @AlexZCP @joelamltc
I migrated to version 3.5.4 it is not fully tested...but if you want you can use it, I will tests it soon and after that I will start migrate this plugin to version 3.6.x, any feedback will be welcome.

@johnfyoung
Copy link

Hi @Kronos66 - I merged your pull request into master and am getting the following error:

Error: Module not found: Error: Can't resolve '../../contexts/EditViewDataManager' in '/Users/johny/Sites/idea/strapi/.cache/plugins/strapi-plugin-content-manager/admin/src/containers/EditViewDataManagerProvider'
    at /Users/johny/Sites/idea/strapi/node_modules/strapi-admin/index.js:71:23
    at finalCallback (/Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compiler.js:257:39)
    at onCompiled (/Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compiler.js:265:20)
    at /Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compiler.js:670:21
    at eval (eval at create (/Users/johny/Sites/idea/strapi/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:26:1)
    at /Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compilation.js:1173:13
    at /Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compilation.js:1096:25
    at /Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compilation.js:1017:13
    at /Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2830:7
    at /Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2830:7
    at done (/Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2863:11)
    at /Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2818:7
    at /Users/johny/Sites/idea/strapi/node_modules/webpack/lib/Compilation.js:1017:13
    at /Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2830:7
    at /Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2830:7
    at done (/Users/johny/Sites/idea/strapi/node_modules/neo-async/async.js:2863:11)

@Kronos66
Copy link
Collaborator

Hi @johnfyoung I checked my PR with strapi@3.5.4 and everything works. Could you describe what exactly you did? Did you rebuild JS from TS? Could you add more details?

@vuolter
Copy link

vuolter commented Aug 29, 2021

Hi everyone! Any update on a solution for this issue?

I'm experiencing the same failures reported by @joelamltc on Strapi v3.6.8, even applying the PR #53. Thanks.

@Kronos66
Copy link
Collaborator

Hi @vuolter
I created new PR with migration to the newest strapi version 3.6.8 #59 on this branch should all work with strapi.

@beneschjozsef
Copy link

beneschjozsef commented Aug 30, 2021

Hi @Kronos66 !

Thank you for your help. I tried your branch and the versionning is worked in the versions table well,
but I didn't find this features on the GUI:

  • Admin entity changes versioning: Now you are able to check and revert all changes you have made on strapi admin.
  • Api entity changes versioning: Also changes made with external api will be visible and reversible

Can you help me how should this features working on the GUI? Or this features shouldn't working on the GUI?

(how I tried: I pulled your repo copied "strapi-molecules\packages\strapi-plugin-versioning" to "extensions\strapi-plugin-versioning" and run build, run dev)

Thnx.

@Kronos66
Copy link
Collaborator

Hi @beneschjozsef
You should see dropdown versioning on the end right sidebar inputs under Delete this entry
image (3)

@beneschjozsef
Copy link

beneschjozsef commented Aug 31, 2021

Hi @Kronos66 !

Maybe I should do different steps. How I tried:

  • Installed the latest Strapi (v3.6.8) with MariaDB.

  • Installed strapi-plugin-versioning: npm add strapi-plugin-versioning

  • I pulled your repo and switch fix/migrate-versioning-3.6.8 branch

  • I copied "strapi-molecules\packages\strapi-plugin-versioning" from your branch to the new strapi "extensions\strapi-plugin-versioning"

  • npm run build

  • npm run develop

Unfortunately the select and the button is not visible to me.
Maybe I should do the copie in a different way. Can you help me how should it work?

Thnx.

@Kronos66
Copy link
Collaborator

Kronos66 commented Aug 31, 2021

Hi @beneschjozsef
I think you forgot about this step from setup:

Copy / merge files from node_modules/strapi-versioning-plugin/extensions to extensions.

Also on copied content-manager extension, you will be able to find file diffs (README.md) to compare your existing content-manager extension to ours.

After the copy, structure looks should that
image (5)

@vuolter
Copy link

vuolter commented Aug 31, 2021

  • I copied "strapi-molecules\packages\strapi-plugin-versioning" from your branch to the new strapi "extensions\strapi-plugin-versioning"

Copy to "extensions\versioning" (instead of "extensions\strapi-plugin-versioning") @beneschjozsef

@beneschjozsef
Copy link

Hi @vuolter !

The button and the select is appeared.
The versions in the DB saved in the versions table.

But the button on the GUI is always disabled.
If I do some changes in the data and after save and refresh the page I can see the version,
but when I try to select the version i created before all the filled data disappear and the Save button change to green and the Revert button is disabled.

So the problem now that i can not revert on the GUI,

Thnx.

@vuolter
Copy link

vuolter commented Sep 7, 2021

Hey @johnfyoung take a look at the recent changes on #59.
Btw make sure you copied the path middlewares/versions-middleware to your project root. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working investigation Issue under investigation waiting for feedback Waiting for reported feedback
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants