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

pnpm install: warning: Failed to create bin at apps/playground/node_modules/.bin/webcrack #58

Closed
milahu opened this issue Feb 13, 2024 · 2 comments · Fixed by #59
Closed
Labels
bug Something isn't working

Comments

@milahu
Copy link
Contributor

milahu commented Feb 13, 2024

Describe the bug

when running pnpm install in the repo root
pnpm is trying to install packages/webcrack to apps/playground
but packages/webcrack is not-yet built at this point

pnpm version 8.15.2
webcrack version e6b584f

git clone --depth=1 https://github.com/j4k0xb/webcrack
cd webcrack
pnpm install

WARN  Failed to create bin at apps/playground/node_modules/.bin/webcrack. ENOENT: no such file or directory, open 'packages/webcrack/dist/cli.js'

WARN  Failed to create bin at apps/playground/node_modules/.bin/webcrack. ENOENT: no such file or directory, open 'apps/playground/node_modules/webcrack/dist/cli.js'

workaround

pnpm install --ignore-scripts
npm run build

possible solution

create a wrapper packages/webcrack/src/cli-wrapper.js for packages/webcrack/dist/cli.js

commit 70500eb14a9c9f1660caad0596cff288ce102ff3
Author: Milan Hauth <milahu@gmail.com>
Date:   Tue Feb 13 14:41:48 2024 +0100

    use bin wrapper

diff --git a/packages/webcrack/package.json b/packages/webcrack/package.json
index f5816c0..6db5072 100644
--- a/packages/webcrack/package.json
+++ b/packages/webcrack/package.json
@@ -7,7 +7,7 @@
   "type": "module",
   "main": "dist/index.js",
   "types": "dist/index.d.ts",
-  "bin": "dist/cli.js",
+  "bin": "src/cli-wrapper.js",
   "files": [
     "dist"
   ],
diff --git a/packages/webcrack/src/cli-wrapper.js b/packages/webcrack/src/cli-wrapper.js
new file mode 100755
index 0000000..dc4b410
--- /dev/null
+++ b/packages/webcrack/src/cli-wrapper.js
@@ -0,0 +1,2 @@
+#!/usr/bin/env node
+import "../dist/cli.js"

Expected Behaviour

no warnings

Code

no

Logs

No response

@milahu milahu added the bug Something isn't working label Feb 13, 2024
@j4k0xb
Copy link
Owner

j4k0xb commented Feb 13, 2024

the cli isn't needed for the playground but would be nice to get rid of the warning either way
wanna create a PR with that wrapper? have to include it in https://docs.npmjs.com/cli/v10/configuring-npm/package-json#files because src isn't published or use https://pnpm.io/package_json#publishconfig with "bin": "dist/cli.js"

@pionxzh
Copy link

pionxzh commented Feb 13, 2024

publishconfig should be the right tool for this unless you want to bind webcrack as an executable in the dev environment.

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.

3 participants