vholik / medusa-custom-attributes

Plugin that extends MedusaJs with custom attributes API
92 stars 20 forks source link

error An unexpected error occurred: "could not find a copy of @medusajs/medusa to link #7

Closed Sylvesterx1 closed 1 year ago

Sylvesterx1 commented 1 year ago

After installation backend not work, admin not work, not possible login etc. Storefront not fetch products from backend API etc.

[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "medusa-custom-attributes > @medusajs/icons@1.1.0" has unmet peer dependency "react@^16.x || ^17.x || ^18.x".
warning " > @tanstack/react-query@4.22.0" has unmet peer dependency "react@^16.8.0 || ^17.0.0 || ^18.0.0".
warning "medusa-custom-attributes > medusa-react@9.0.11" has unmet peer dependency "react@^16.8 || ^17.0 || ^18.0".
warning "medusa-custom-attributes > medusa-react@9.0.11" has unmet peer dependency "react-dom@^16.8 || ^17.0 || ^18.0".
warning " > prism-react-renderer@2.1.0" has unmet peer dependency "react@>=16.0.0".
warning "@medusajs/admin > @medusajs/admin-ui > react-json-tree@0.17.0" has unmet peer dependency "@types/react@^16.3.0 || ^17.0.0 || ^18.0.0".
warning "@medusajs/admin > @medusajs/admin-ui > react-hot-toast > goober@2.1.13" has unmet peer dependency "csstype@^3.0.10".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/merge@9.0.0" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/schema@10.0.0" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/merge > @graphql-tools/utils@10.0.7" has unmet peer dependency "graphql@^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/cache-inmemory > @medusajs/modules-sdk > @graphql-tools/merge > @graphql-tools/utils > @graphql-typed-document-node/core@3.2.0" has unmet peer dependency "graphql@^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0".
warning "@medusajs/medusa > ioredis-mock@8.4.0" has unmet peer dependency "@types/ioredis-mock@^8".
warning " > medusa-custom-attributes@1.0.3" has unmet peer dependency "@medusajs/icons@^1.0.0".
warning " > medusa-custom-attributes@1.0.3" has unmet peer dependency "@medusajs/ui@^2.2.0".
warning " > medusa-custom-attributes@1.0.3" has unmet peer dependency "medusa-react@^9.0.9".
warning " > medusa-custom-attributes@1.0.3" has unmet peer dependency "react@^18.2.0".
warning " > medusa-custom-attributes@1.0.3" has unmet peer dependency "react-dom@^18.2.0".
warning " > ts-loader@9.5.0" has unmet peer dependency "webpack@^5.0.0".
error An unexpected error occurred: "could not find a copy of @medusajs/medusa to link in C:\\Users\\\\\medusa-project\\commerce\\node_modules\\medusa-custom-attributes\\node_modules".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\\medusa-project\\commerce\\yarn-error.log".

@update After delete node_modules and install again, I try run server and get (migrations done):

 Initializing database
error:   Error starting server
TypeORMError: Entity metadata for ProductCategory#products was not found. Check if you specified a correct entity object and if it's connected in the connection options.
    at C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:720:23
    at Array.forEach (<anonymous>)
    at EntityMetadataBuilder.computeInverseProperties (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:713:34)
    at C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:84:58
    at Array.forEach (<anonymous>)
    at EntityMetadataBuilder.build (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\metadata-builder\EntityMetadataBuilder.js:84:25)
    at ConnectionMetadataBuilder.buildEntityMetadatas (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\connection\ConnectionMetadataBuilder.js:66:150)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async DataSource.buildMetadatas (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\data-source\DataSource.js:460:33)
    at async DataSource.initialize (C:\Users\...\...\medusa-project\commerce\node_modules\typeorm\data-source\DataSource.js:141:13)
vholik commented 1 year ago

What version of Medusa.js do you use? Try add MEDUSA_FF_PRODUCT_CATEGORIES=true in your .env file due to usage of product_category in some models and running migrations again

Sylvesterx1 commented 1 year ago

Hi, all up to date, fresh installation from yesterday. Currently I have enabled categories directly in medusa config.js Yesterday I try also enable in env but still the same issue.

bogdannistorbogdan commented 1 year ago

Hey guys, I am having the same issue. I have a fresh MedusaJS installation. I just followed your tutorial and I get the error:

error: Error starting server TypeORMError: Entity metadata for ProductCategory#products was not found. Check if you specified a correct entity object and if it's connected in the connection options. at /Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js:720:23 at Array.forEach () at EntityMetadataBuilder.computeInverseProperties (/Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js:713:34) at /Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js:84:58 at Array.forEach () at EntityMetadataBuilder.build (/Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js:84:25) at ConnectionMetadataBuilder.buildEntityMetadatas (/Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/connection/ConnectionMetadataBuilder.js:66:150) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async DataSource.buildMetadatas (/Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/data-source/DataSource.js:460:33) at async DataSource.initialize (/Users/bogdanfloriannistor/Developer/NodeJs/markline-medusa-v3/markline-medusa-store-v3/node_modules/typeorm/data-source/DataSource.js:141:13)

bogdannistorbogdan commented 1 year ago

And I do have MEDUSA_FF_PRODUCT_CATEGORIES set to true in .env.

Sylvesterx1 commented 1 year ago

@vholik Can you look into this issue on a clean install? Your module has a lot of potential and contribution to development, so it would be good to solve it; )

vholik commented 1 year ago

Can confirm this problem on a fresh medusa install. Thanks guys for addressing this issue. Now you can just hit yarn add medusa-custom-attributes to update package version to 1.0.5 and problem with yarn linking and category metadata should be resolved!

Sylvesterx1 commented 1 year ago

@vholik I confirm that after the update the problem was solved. Thank you for your contribution.