Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
383 stars 113 forks source link

issue with running npm run dev #4052

Open ElonMuskOfficial opened 1 month ago

ElonMuskOfficial commented 1 month ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Function

Expected behavior

This should run without any errors

Actual behavior

I am just installed Cart Transform Function setup and then run this and getting this error

── external error ────────────────────────────────────────────────────────────────────

Error coming from npm exec -- javy-cli --version

Command failed with exit code 3221225477: npm exec -- javy-cli --version

────────────────────────────────────────────────────────────────────────────────

Verbose output

npm run dev -- --verbose

npm verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@10.8.1
npm info using node@v20.10.0
npm verbose title npm run dev
npm verbose argv "run" "dev" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:C:\Users\ElonMusk\AppData\Local\npm-cache\_logs\2024-06-14T10_59_59_726Z-
npm verbose logfile C:\Users\ElonMusk\AppData\Local\npm-cache\_logs\2024-06-14T10_59_59_726Z-debug-0.log

> cart-transform-api@1.0.0 dev
> shopify app dev

16:30:12 │ graphiql         │ GraphiQL server started on port 3457

── external error ────────────────────────────────────────────────────────────────────

Error coming from `npm exec -- javy-cli --version`

Command failed with exit code 3221225477: npm exec -- javy-cli --version
npm verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@10.8.1
npm info using node@v20.10.0
npm verbose title npm exec javy-cli --version
npm verbose argv "exec" "--" "javy-cli" "--version"
npm verbose logfile logs-max:10 dir:C:\Users\ElonMusk\AppData\Local\npm-cache\_logs\2024-06-14T11_00_12_665Z-
npm verbose logfile C:\Users\ElonMusk\AppData\Local\npm-cache\_logs\2024-06-14T11_00_12_665Z-debug-0.log
npm verbose shrinkwrap failed to load node_modules/.package-lock.json out of date, updated: extensions/cart-transformer
npm http fetch GET 200 https://registry.npmjs.org/javy-cli 1043ms (cache revalidated)
npm verbose cwd D:\SHOPIFY\cart-transform-api
npm verbose os Windows_NT 10.0.22631
npm verbose node v20.10.0
npm verbose npm  v10.8.1
npm verbose exit 3221225477
npm verbose code 3221225477

──────────────────────────────────────────────────────────────────────────────────────

npm verbose cwd D:\SHOPIFY\cart-transform-api
npm verbose os Windows_NT 10.0.22631
npm verbose node v20.10.0
npm verbose npm  v10.8.1
npm verbose exit 1
npm verbose code 1

Reproduction steps

  1. npm run dev -- --verbose

Operating System

Windows 11

Shopify CLI version (check your project's package.json if you're not sure)

3.61.2

Shell

No response

Node version (run node -v if you're not sure)

20.10.0

What language and version are you using in your application?

No response

HitenXCode commented 1 month ago

facing same issue with the shipping discount extension

zane-wky commented 1 month ago

https://github.com/Shopify/cli/issues/2626 Someone mentioned the same problem in this link

ElonMuskOfficial commented 1 month ago

@zane-wky I tried but it not working in my system

ElonMuskOfficial commented 1 month ago

I found a solution to the issue. Here are the steps I followed:

  1. Downloaded javy-x86_64-windows-v1.4.0.gz from the Javy GitHub releases page.

  2. Extracted the file to get javy.exe.

  3. Copied javy.exe to the directory: C:\Users\<username>\AppData\Local\binarycache\Cache.

  4. Renamed javy.exe to javy-v2.0.0 (removed the .exe extension).

  5. Ran the project again, and it worked successfully.

These steps resolved the issue for me.

Hope this helps!

Chris-Okendo commented 1 month ago

Im seeing the same error come from shopify app function build when trying to build a discount extension

Swapping in the binary from the Javy release page hasnt resolved it and neither has using the FORCE_RELEASE env var that is provided by Javy. Ive also deleted the javy binaries from the cache as mentioned here and here

Update

After trying the binary download and rename to no avail i was able to get a fix by doing the following

  1. Invoke the javy binary directly via cmd not powershell
  2. This gave me an error like below
    Administrator@ip-AC1F06F2 MINGW64 ~/AppData/Local/binarycache/Cache
    $ ./javy-v2.0.0
    C:/Users/Administrator/AppData/Local/binarycache/Cache/javy-v2.0.0: error while loading shared libraries: VCRUNTIME140_1.dll: cannot open shared object file: No such file or directory
  3. a quick google told me the missing .dll was provided by microsoft via this redist
  4. downloaded and installed the latest for my arch
  5. build runs successfully using the latest javy version without any binary renames or manual downloads.
HitenXCode commented 1 month ago

below solution worked for me!!!

I found a solution to the issue. Here are the steps I followed:

Downloaded javy-x86_64-windows-v1.4.0.gz from the Javy GitHub releases page.

Extracted the file to get javy.exe.

Copied javy.exe to the directory: C:\Users\\AppData\Local\binarycache\Cache.

Renamed javy.exe to javy-v2.0.0 (removed the .exe extension).

Ran the project again, and it worked successfully.

These steps resolved the issue for me.

Hope this helps!

nickwesselman commented 4 weeks ago

Installing Visual C++ Redistributable appears to be the right solution — I would not recommend renaming binaries as there are great things in Javy 2.0 that you will want to take advantage of.

We are looking into why this dependency was introduced and whether we can remove it.

saulecabrera commented 4 weeks ago

I've opened https://github.com/bytecodealliance/javy/pull/670 and I've confirmed that it fixes the issues and restores the behavior of the previous version (which doesn't require installing Visual C++).