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

npm run deploy: "$npm_execpath" isn't recognized as an internal or external command, program, or executable batch file #52

Open
axww opened this issue Jun 20, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@axww
Copy link

axww commented Jun 20, 2024

What version of Hono are you using?

4.4.7

What runtime/platform is your app running on?

Windows, Node.js v22.3.0

What steps can reproduce the bug?

Hi, it's the Windows guy again.

When I run npm run deploy, it shows error:
"$npm_execpath" isn't recognized as an internal or external command, program, or executable batch file

According to:
https://stackoverflow.com/questions/53883405/npm-execpath-isnt-recognized-as-an-internal-or-external-command-program-or

I changed from:
"deploy": "$npm_execpath run build && wrangler pages deploy"
to:
"deploy": "npm run build && wrangler pages deploy"

Then the problem solved.
Is there a solution which compatible both Windows and Linux?

Thank you
Best

@axww axww added the bug Something isn't working label Jun 20, 2024
@yusukebe yusukebe transferred this issue from honojs/hono Jun 21, 2024
@yusukebe
Copy link
Member

Hi @axww

Thank you for creating the issue. This is a create-hono matter, so I've transferred.

@6km @ryuapp @goisaki

I think we can avoid this issue if we make the create-hono change $npm_execpath to the proper package manager command. What do you think of this?

@goisaki
Copy link
Contributor

goisaki commented Jun 21, 2024

Hi @yusukebe, @axww
I think it's good. Can I create a solution PR?

@ryuapp
Copy link
Contributor

ryuapp commented Jun 21, 2024

I think we can avoid this issue if we make the create-hono change $npm_execpath to the proper package manager command. What do you think of this?

Sounds nice, but in my opinion, I don't need the build command in deploy alias.
Even in Cloudflare docs, the deploy alias does not include a build command.
https://developers.cloudflare.com/workers/wrangler/commands/#how-to-run-wrangler-commands

If you would like to include a build command, it would be good if we could control it with create-hono as you intended.

@yusukebe
Copy link
Member

@ryuapp

Sounds nice, but in my opinion, I don't need the build command in deploy alias.

You may be right. This is kind of a personal taste. I like to include the build command in the deploy command so I don't forget to build.

@yusukebe
Copy link
Member

@goisaki

I think it's good. Can I create a solution PR?

Can you work on this?

@6km
Copy link
Contributor

6km commented Jun 24, 2024

Hi @yusukebe! I was busy for the last a few days.

The problem is that the syntax of environment variables is different on each platforms.
For example, It's %VARIABLE% on Windows, but it's $VARIABLE on Unix.

A Stack Overflow answer suggests using yarpm to deal with the difference of package managers when using run scripts. I guess it's a good way to deal with this issue, but is there a way to deal with it without using external packages?

EDIT: I just found out that yarpm can't detect bun.

@yusukebe
Copy link
Member

Hi @6km

Thank you for the information. Hmm, suppose we'll have to replace $npm_execpath after all.

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

No branches or pull requests

5 participants