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

Unable to create with npx #41

Closed
weilinzung opened this issue Jun 27, 2021 · 11 comments
Closed

Unable to create with npx #41

weilinzung opened this issue Jun 27, 2021 · 11 comments

Comments

@weilinzung
Copy link
Contributor

npx --yes -- create-figma-plugin figma-hello-world --yes

npm --version
7.19.0
file:///Users/xxx/.npm/_npx/439399134eb6e80a/node_modules/create-figma-plugin/lib/utilities/settings/create-plugin-display-name.js:1
import { titleCase } from 'title-case';
         ^^^^^^^^^
SyntaxError: The requested module 'title-case' does not provide an export named 'titleCase'
    at ModuleJob._instantiate (internal/modules/esm/module_job.js:92:21)
    at async ModuleJob.run (internal/modules/esm/module_job.js:107:20)
    at async Loader.import (internal/modules/esm/loader.js:179:24)

Thoughts???

@yuanqing
Copy link
Owner

Node.js v14 is required to use 1.0.0 of this toolkit

@weilinzung
Copy link
Contributor Author

yeah, I am already on node v14.0.0. 😑

@yuanqing
Copy link
Owner

Unfortunately, I’m not able to replicate this problem locally.

$ node --version
v14.15.4
$ npm --version
7.19.0
$ npx --yes -- create-figma-plugin figma-hello-world --yes
info Scaffolding a new plugin...
info Cloning template...
info Installing dependencies...
success Done
$ cd figma-hello-world
$ npm run build

> figma-hello-world@1.0.0 build
> build-figma-plugin --typecheck --minify

info Building...
success Built in 2.437s

@yuanqing
Copy link
Owner

Other boilerplates/tools that you can consider using instead of Create Figma Plugin: https://github.com/thomas-lowry/figma-plugins-on-github#resources

@Jeremy-Knudsen
Copy link

I am having an issue as well, but mine is when I omit the second --yes from the npx command ... when I do that I type in the info for each prompt, and then I get to the end and I see this message: error The "path" argument must be of type string. Received undefined

However, I was never prompted to input a path?

image

@yuanqing
Copy link
Owner

yuanqing commented Jul 3, 2021

@Jeremy-Knudsen Ah! There’s a bug with the CLI argument parsing. Until a fix is released, you will need to do something like this:

$ npx --yes -- create-figma-plugin figma-hello-world --template default

@yuanqing
Copy link
Owner

yuanqing commented Jul 3, 2021

@Jeremy-Knudsen The bug you reported should be fixed as of 1.2.1

@weilinzung
Copy link
Contributor Author

@yuanqing it is strange, only title-case package gives me the error.

I have to remove that usage to make it work for now.

@weilinzung
Copy link
Contributor Author

Also, getting other error

➜  figma-hello-world2  npm run watch

> watch
> build-figma-plugin --typecheck --watch

internal/modules/run_main.js:54
    internalBinding('errors').triggerUncaughtException(
                              ^

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:666:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:42:40)
    at link (internal/modules/esm/module_job.js:41:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

@weilinzung
Copy link
Contributor Author

It maybe just my desktop issue, switch to another computer which seems fine now. thanks!

@iamtekeste
Copy link

For anyone else facing this issue

Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
    at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:666:11)
    at Loader.resolve (internal/modules/esm/loader.js:97:40)
    at Loader.getModuleJob (internal/modules/esm/loader.js:243:28)
    at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:42:40)
    at link (internal/modules/esm/module_job.js:41:36) {
  code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}

It went away after after I upgraded my node version from v14.1.0 to v14.15.4 and my npm version to 7.19.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants