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

This module doesn't work with yarn create #143

Open
wt opened this issue Apr 7, 2020 · 1 comment
Open

This module doesn't work with yarn create #143

wt opened this issue Apr 7, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@wt
Copy link

wt commented Apr 7, 2020

Describe the Bug

The yarn equivalent for npm init wasm-app www is `yarn create wasm-app www', but it doesn't work with this module.

Steps to Reproduce

  1. mkdir blah
  2. cd blah
  3. yarn create wasm-app www
  4. See error

Expected Behavior

The www directory gets created like when I run npm init wasm-app www.

Actual Behavior

Here's my output:

wt@XXXXXXX:~/projects/blah$ yarn create wasm-app www
yarn create v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "create-wasm-app@0.1.0" with binaries:
      - create-wasm-app
/bin/sh: 1: /home/wt/.yarn/bin/create-wasm-app: not found
error Command failed.
Exit code: 127
Command: /home/wt/.yarn/bin/create-wasm-app
Arguments: www
Directory: /home/wt/projects/blah
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

Additional Context

I was following the project tutorial except that I wanted to use yarn.

@wt wt added the bug Something isn't working label Apr 7, 2020
@wiaxr
Copy link

wiaxr commented Jun 18, 2020

It looks like the same issue as rustwasm/wasm_game_of_life#34

Try the patch below.
It seems the problem in the .bin dir. It has to be renamed .bin -> ./bin and .bin dir is for the node_modules/.bin only.
With .bin dir in the root the command yarn global add create-wasm-app does NOT only create soft links in the dir $(yarn global bin), but yet it deletes other links from that dir.
So, the command yarn create wasm-app does not work.

Tested with a local git clone of the create-wasm-app.
The link is created as required, but the yarn create command still fails.
It seems it implicitly reinstalls the npm package while execiting (why to reinstall?).
So, it is to update the package in the global repository.

ls -l  ~/.yarn/bin
ls -l $(yarn global bin)
lrwxrwxrwx ... create-wasm-app -> ../../.config/yarn/global/node_modules/.bin/create-wasm-app
diff --git a/.bin/create-wasm-app.js b/bin/create-wasm-app.js
similarity index 100%
rename from .bin/create-wasm-app.js
rename to bin/create-wasm-app.js
diff --git a/package.json b/package.json
index d21d358..1731e4f 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "create an app to consume rust-generated wasm packages",
   "main": "index.js",
   "bin": {
-    "create-wasm-app": ".bin/create-wasm-app.js"
+    "create-wasm-app": "./bin/create-wasm-app.js"
   },
   "scripts": {
     "build": "webpack --config webpack.config.js",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants