code-connect icon indicating copy to clipboard operation
code-connect copied to clipboard

Unable to set figma file location during interactive setup

Open AndyJPhillips-lively opened this issue 1 year ago • 9 comments

Hey team,

I'm getting an issue when using the interactive setup. Currently, whenever I get to the following step, it throws an error no-matter what input I provide (a valid directory path or hit enter for co-location)

What directory should Code Connect files be created in? (Press enter to co-locate your files alongside your component files)

Below is the full stack trace:-

? What directory should Code Connect files be created in? (Press enter to co-locate your files alongside your component files) › node:internal/readline/emitKeypressEvents:74
            throw err;
            ^

TypeError: Cannot read properties of undefined (reading 'disabled')
    at SelectPrompt.submit (<REDACTED_PATH>/node_modules/prompts/lib/elements/select.js:68:25)
    at ReadStream.keypress (<REDACTED_PATH>/node_modules/prompts/lib/elements/prompt.js:32:16)
    at ReadStream.emit (node:events:530:35)
    at emitKeys (node:internal/readline/utils:371:14)
    at emitKeys.next (<anonymous>)
    at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36)
    at ReadStream.emit (node:events:530:35)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)

Node.js v20.18.1

It looks like an error is being thrown for the CLI prompt, but would appreciate any assistance if this is a user error.

I have added --verbose flag with the above error thrown.

thanks!

  • Code Connect CLI version
    • 1.2.4
  • Operating system
    • macOS 15.2 (24C101)

AndyJPhillips-lively avatar Jan 24 '25 13:01 AndyJPhillips-lively

Hey team, any update on this? thanks.

AndyJPhillips-lively avatar Feb 03 '25 13:02 AndyJPhillips-lively

Hi @AndyJPhillips-lively. I can't seem to replicate this with the same Node and Code Connect version installed. Do you mind updating to the latest version of Code Connect to see if that changes anything for you?

rgullyfigma avatar Feb 20 '25 09:02 rgullyfigma

I'm running into the same problem as @AndyJPhillips-lively - here's my call stack (after pressing "enter" to accept the default)

A Code Connect file is created for each Figma component to code definition match. ? In which directory would you like to store Code Connect files? (Press enter to co-locate your files alongside your component files) › node:internal/readline/emitKeypressEvents:74 throw err; ^

TypeError: Cannot read properties of undefined (reading 'disabled') at SelectPrompt.submit (Redacted.nvm/versions/node/v23.9.0/lib/node_modules/@figma/code-connect/node_modules/prompts/lib/elements/select.js:68:25) at ReadStream.keypress (Redacted.nvm/versions/node/v23.9.0/lib/node_modules/@figma/code-connect/node_modules/prompts/lib/elements/prompt.js:32:16) at ReadStream.emit (node:events:519:35) at emitKeys (node:internal/readline/utils:370:14) at emitKeys.next () at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36) at ReadStream.emit (node:events:519:35) at addChunk (node:internal/streams/readable:559:12) at readableAddChunkPushByteMode (node:internal/streams/readable:510:3) at Readable.push (node:internal/streams/readable:390:5)

  • Code Connect CLI version : 1.3.1
  • OS : MacOS 15.3.1
  • Node version : 23.9.0

mefsap avatar Mar 03 '25 18:03 mefsap

Hey @rgullyfigma, I have updated to the latest, but still no luck. I did a little bit of debugging and was able to pin it down to failing on the following line at @figma/code-connect/dist/connect/wizard/run_wizard.js :-

const answers = await (0, prompts_1.default)(question); line 141

Image

Based on the error, I would assume that the prompts package is assuming this question is a select (which obviously isn't the case). I looked at the args you are passing in and it looks correct. The only other thing I can think of is that it the version of prompts might not be compatible. Could you provide me with your version of prompts and see if that get's me up and running?

AndyJPhillips-lively avatar Mar 10 '25 13:03 AndyJPhillips-lively

Alternatively, is there a way I can get setup without going through this process? thanks.

AndyJPhillips-lively avatar Mar 13 '25 12:03 AndyJPhillips-lively

@AndyJPhillips-lively I'll make the team aware of this issue and hopefully we can have a fix for this shortly. In the meantime you should be able to create the figma.connect() files manually and then using the npx figma connect publish command to avoid needing the wizard.

rgullyfigma avatar Mar 24 '25 13:03 rgullyfigma

fwiw, noticed that the CLI has been updated to 1.3.2 (here, but not here), so thought I would give it another try. Unfortunately, I'm still seeing the same "Cannot read properties of undefined (reading 'disabled')" issue.

mefsap avatar May 22 '25 21:05 mefsap

顺便说一句,我注意到 CLI 已经更新到 1.3.2 了(这里,而不是这里),所以我想再试一次。不幸的是,我仍然看到同样的“无法读取未定义的属性(读取‘已禁用’)”问题。

RanXueliang avatar Jun 23 '25 07:06 RanXueliang

Running into this issue as well. Since the interactive settings are all defaulted when running into this issue, I feel like this should be a high priority task.

  • node: 20.10.0
  • @figma/code-connect: 1.3.4 (latest)

irontitan76 avatar Jul 08 '25 18:07 irontitan76