Skip to content

use lc -a command again and there's some error at terminal  #63

@SmallTeddy

Description

@SmallTeddy

1、realm no data
image

2、use lc -a to create all questions
image

3、all questions data in database
image

4、use lc -a again and error appeared
image

> leetcode-practice@1.0.9-4 lc /Users/zhangzeming/Documents/GitHub/leetcode-practice
> node bin/lc.js -d src "-a"

/Users/zhangzeming/Documents/GitHub/leetcode-practice/node_modules/.pnpm/realm@12.6.2/node_modules/realm/dist/Object.js:215
                throw new Error(`Attempting to create an object of type '${name}' with an existing primary key value '${primaryKeyValue}'.`);
                      ^

Error: Attempting to create an object of type 'AllQuestion' with an existing primary key value '1'.
    at Realm.Object.createObj (/Users/zhangzeming/Documents/GitHub/leetcode-practice/node_modules/.pnpm/realm@12.6.2/node_modules/realm/dist/Object.js:215:23)
    at Realm.Object.create (/Users/zhangzeming/Documents/GitHub/leetcode-practice/node_modules/.pnpm/realm@12.6.2/node_modules/realm/dist/Object.js:158:63)
    at Realm.create (/Users/zhangzeming/Documents/GitHub/leetcode-practice/node_modules/.pnpm/realm@12.6.2/node_modules/realm/dist/Realm.js:553:50)
    at file:///Users/zhangzeming/Documents/GitHub/leetcode-practice/common/utils/store/controller/allQuestion.js:90:33
    at Realm.write (/Users/zhangzeming/Documents/GitHub/leetcode-practice/node_modules/.pnpm/realm@12.6.2/node_modules/realm/dist/Realm.js:788:22)
    at file:///Users/zhangzeming/Documents/GitHub/leetcode-practice/common/utils/store/controller/allQuestion.js:86:11
    at exeOnce (file:///Users/zhangzeming/Documents/GitHub/leetcode-practice/common/utils/store/store-realm.js:38:21)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.all (file:///Users/zhangzeming/Documents/GitHub/leetcode-practice/bin/lc.js:66:5)
    at async file:///Users/zhangzeming/Documents/GitHub/leetcode-practice/bin/lc.js:75:1

Node.js v18.16.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions