question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Init a new vendure project doesn't work

See original GitHub issue

Describe the bug After Init a new vendure project and try to run it, it gives database errors:

yarn run v1.22.15
yarn run v1.22.15
$ ts-node ./src/index-worker.ts
$ ts-node ./src/index.ts
[run:*server] info 3/4/22, 12:15 PM - [Vendure Server] Bootstrapping Vendure Server (pid: 217222)... 
[run:*worker] info 3/4/22, 12:15 PM - [Vendure Worker] Bootstrapping Vendure Worker (pid: 217215)... 
[run:*server] error 3/4/22, 12:15 PM - [TypeOrmModule] Unable to connect to the database. Retrying (1)...
[run:*server] QueryFailedError: ER_CANT_DROP_FIELD_OR_KEY: Can't DROP FOREIGN KEY `FK_7256fef1bb42f1b38156b7449f5`; check that it exists
[run:*server]     at QueryFailedError.TypeORMError [as constructor] (/home/ayub/Documents/dev/lab/my-store/src/error/TypeORMError.ts:7:9)
[run:*server]     at new QueryFailedError (/home/ayub/Documents/dev/lab/my-store/src/error/QueryFailedError.ts:9:9)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/src/driver/mysql/MysqlQueryRunner.ts:183:37)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:526:10)
[run:*server]     at Query._callback (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:488:16)
[run:*server]     at Query.Sequence.end (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
[run:*server]     at Query.ErrorPacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
[run:*server]     at Protocol._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Protocol.js:291:23)
[run:*server]     at Parser._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:433:10)
[run:*server]     at Parser.write (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:43:10) 
[run:*server] error 3/4/22, 12:16 PM - [TypeOrmModule] Unable to connect to the database. Retrying (2)...
[run:*server] QueryFailedError: ER_CANT_DROP_FIELD_OR_KEY: Can't DROP FOREIGN KEY `FK_7ee3306d7638aa85ca90d672198`; check that it exists
[run:*server]     at QueryFailedError.TypeORMError [as constructor] (/home/ayub/Documents/dev/lab/my-store/src/error/TypeORMError.ts:7:9)
[run:*server]     at new QueryFailedError (/home/ayub/Documents/dev/lab/my-store/src/error/QueryFailedError.ts:9:9)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/src/driver/mysql/MysqlQueryRunner.ts:183:37)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:526:10)
[run:*server]     at Query._callback (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:488:16)
[run:*server]     at Query.Sequence.end (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
[run:*server]     at Query.ErrorPacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
[run:*server]     at Protocol._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Protocol.js:291:23)
[run:*server]     at Parser._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:433:10)
[run:*server]     at Parser.write (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:43:10) 
[run:*worker] info 3/4/22, 12:17 PM - [Vendure Worker] Vendure Worker is ready 
[run:*worker] info 3/4/22, 12:17 PM - [JobQueue] Starting queue: apply-collection-filters 
[run:*worker] info 3/4/22, 12:17 PM - [JobQueue] Starting queue: send-email 
[run:*worker] info 3/4/22, 12:17 PM - [JobQueue] Starting queue: update-search-index 
[run:*server] error 3/4/22, 12:17 PM - [TypeOrmModule] Unable to connect to the database. Retrying (3)...
[run:*server] QueryFailedError: ER_CANT_CREATE_TABLE: Can't create table `mystore1`.`product_option_group` (errno: 121 "Duplicate key on write or update")
[run:*server]     at QueryFailedError.TypeORMError [as constructor] (/home/ayub/Documents/dev/lab/my-store/src/error/TypeORMError.ts:7:9)
[run:*server]     at new QueryFailedError (/home/ayub/Documents/dev/lab/my-store/src/error/QueryFailedError.ts:9:9)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/src/driver/mysql/MysqlQueryRunner.ts:183:37)
[run:*server]     at Query.<anonymous> (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:526:10)
[run:*server]     at Query._callback (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/Connection.js:488:16)
[run:*server]     at Query.Sequence.end (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
[run:*server]     at Query.ErrorPacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
[run:*server]     at Protocol._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Protocol.js:291:23)
[run:*server]     at Parser._parsePacket (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:433:10)
[run:*server]     at Parser.write (/home/ayub/Documents/dev/lab/my-store/node_modules/mysql/lib/protocol/Parser.js:43:10)

To Reproduce Steps to reproduce the behavior:

  1. npm init @vendure my-store
  2. finish the installation (I tried with populating data and without)
  3. go to the project folder
  4. execute npm run start

Expected behavior A clear and concise description of what you expected to happen.

Environment (please complete the following information):

  • v12.22.9
  • mysql

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
AyubToubacommented, Mar 4, 2022

I was choosing MySQL instead of MariaDB, no problems now,

Thank you

0reactions
michaelbromleycommented, Mar 4, 2022

What version of mysql?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Git in Visual Studio - add existing project? - Stack Overflow
Right click the solution name in Solution Explorer. Select "Add to Source Control". Then head over to SourceTree, and select Clone/New. Select Add...
Read more >
Git Guides - git init - GitHub
git init is one way to start a new project with Git. To start a repository, use either git init or git clone...
Read more >
How to Fix the “fatal: not a git repository” Error - ContainIQ
Check that you correctly created the repo. If the directory doesn't contain a .git repo, use git init to properly initialize the repo...
Read more >
init | Data Version Control - DVC
Open -source version control system for Data Science and Machine Learning projects. Git-like experience to organize your data, models, and experiments.
Read more >
How to Push an Existing Project to GitHub - DigitalOcean
Step 1 — Create a new GitHub Repo. Sign in to GitHub and create a new empty repo. You can choose to either...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found