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

[Bug?]: Updating from 7.3.0 to 7.4.1 will fail, if there is no npx available #10466

Closed
1 task
j-tag opened this issue Apr 16, 2024 · 4 comments · Fixed by #10479
Closed
1 task

[Bug?]: Updating from 7.3.0 to 7.4.1 will fail, if there is no npx available #10466

j-tag opened this issue Apr 16, 2024 · 4 comments · Fixed by #10479
Labels
bug/confirmed We have confirmed this is a bug

Comments

@j-tag
Copy link

j-tag commented Apr 16, 2024

What's not working?

If I use yarn rw upgrade to upgrade from 7.3.0 to 7.4.1 and no npx will be available in my $PATH. I'll get this error:

❯ rw upgrade
✔ Checking latest version
✔ Updating your Redwood version
  ✔ Updating /home/user/my-project/package.json
  ✔ Updating /home/user/my-project/api/package.json
  ✔ Updating /home/user/my-project/web/package.json
✔ Running yarn install
✔ Refreshing the Prisma client
✖ Could not finish de-duplication. For yarn 1.x, please run `npx yarn-deduplicate`, or for yarn 3 run `yarn dedupe` before continuing
◼ One more thing..

Command failed with ENOENT: npx --version
spawn npx ENOENT
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Could not finish de-duplication. For yarn 1.x, please run `npx yarn-deduplicate`, or for yarn 3 run `yarn dedupe` before continuing
    at dedupeDeps (/home/user/my-project/node_modules/@redwoodjs/cli/dist/commands/upgrade.js:396:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _Task.run (/home/user/my-project/node_modules/listr2/dist/index.cjs:2049:11)

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Need help?
 - Not sure about something or need advice? Reach out on our Forum (​https://community.redwoodjs.com/​)
 - Think you've found a bug? Open an issue on our GitHub (​https://github.com/redwoodjs/redwood​)
 - Here's your unique error reference to quote: '79c7e40e-a734-44eb-9864-6d9ac21a6a0d'
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


This is because I'm using corepack thus I don't need to install npm/npx separately. But Redwood seems to expect npx to be available on my system.

I tried on another pc which had npm/npx available globally without corepack and upgrade works without any issues.

How do we reproduce the bug?

You should not have npm/npx through global installation. If you use corepack only, this issue will happen.

What's your environment? (If it applies)

❯ rw info

  System:
    OS: Linux 6.8 Arch Linux
    Shell: 3.7.1 - /usr/bin/fish
  Binaries:
    Node: 20.12.2 - /tmp/xfs-8c26666e/node
    Yarn: 4.0.2 - /tmp/xfs-8c26666e/yarn
  Databases:
    SQLite: 3.45.2 - /usr/bin/sqlite3
  npmPackages:
    @redwoodjs/auth-dbauth-setup: 7.4.1 => 7.4.1 
    @redwoodjs/core: 7.4.1 => 7.4.1 
    @redwoodjs/realtime: 7.4.1 => 7.4.1 
    @redwoodjs/studio: 11 => 11.3.1

Are you interested in working on this?

  • I'm interested in working on this
@j-tag j-tag added the bug/needs-info More information is needed for reproduction label Apr 16, 2024
@ahaywood
Copy link
Contributor

@j-tag Thanks for filing this issue. I'll see if I can get to the bottom of it.

@j-tag
Copy link
Author

j-tag commented Apr 17, 2024

@j-tag Thanks for filing this issue. I'll see if I can get to the bottom of it.

Thank you

@Josh-Walker-GM Josh-Walker-GM added bug/confirmed We have confirmed this is a bug and removed bug/needs-info More information is needed for reproduction labels Apr 19, 2024
Josh-Walker-GM added a commit that referenced this issue Apr 19, 2024
**Problem**
Fixes #10466.

During `yarn rw upgrade` we check the version of `npx` installed. It's
entirely possible that `npx` is not available or installed.

We only do this check because we have to handle dedupe differently
between yarn v1 and yarn >v1. We specify that redwood projects should be
using yarn v4 using `"packageManager": "yarn@4.1.1"` in the
`package.json`. Therefore when following the recommended setup users
should not be using yarn v1 in their redwood projects.

**Changes**
1. Avoid `npx` version check.
2. Skip dedupe step if for some reason have yarn v1. When this happens
we log a warning message to tell the user to run a command manually to
dedupe.
Josh-Walker-GM added a commit that referenced this issue Apr 19, 2024
**Problem**
Fixes #10466.

During `yarn rw upgrade` we check the version of `npx` installed. It's
entirely possible that `npx` is not available or installed.

We only do this check because we have to handle dedupe differently
between yarn v1 and yarn >v1. We specify that redwood projects should be
using yarn v4 using `"packageManager": "yarn@4.1.1"` in the
`package.json`. Therefore when following the recommended setup users
should not be using yarn v1 in their redwood projects.

**Changes**
1. Avoid `npx` version check.
2. Skip dedupe step if for some reason have yarn v1. When this happens
we log a warning message to tell the user to run a command manually to
dedupe.
Josh-Walker-GM added a commit that referenced this issue Apr 19, 2024
**Problem**
Fixes #10466.

During `yarn rw upgrade` we check the version of `npx` installed. It's
entirely possible that `npx` is not available or installed.

We only do this check because we have to handle dedupe differently
between yarn v1 and yarn >v1. We specify that redwood projects should be
using yarn v4 using `"packageManager": "yarn@4.1.1"` in the
`package.json`. Therefore when following the recommended setup users
should not be using yarn v1 in their redwood projects.

**Changes**
1. Avoid `npx` version check.
2. Skip dedupe step if for some reason have yarn v1. When this happens
we log a warning message to tell the user to run a command manually to
dedupe.
Josh-Walker-GM added a commit that referenced this issue Apr 19, 2024
**Problem**
Fixes #10466.

During `yarn rw upgrade` we check the version of `npx` installed. It's
entirely possible that `npx` is not available or installed.

We only do this check because we have to handle dedupe differently
between yarn v1 and yarn >v1. We specify that redwood projects should be
using yarn v4 using `"packageManager": "yarn@4.1.1"` in the
`package.json`. Therefore when following the recommended setup users
should not be using yarn v1 in their redwood projects.

**Changes**
1. Avoid `npx` version check.
2. Skip dedupe step if for some reason have yarn v1. When this happens
we log a warning message to tell the user to run a command manually to
dedupe.
@Josh-Walker-GM
Copy link
Collaborator

So v7.4.2 should have this fix included within it.

Of course, this is slightly more difficult because it's the upgrade command itself that has a bug for you. If you do manually upgrade to this new version you should find the upgrade command works fine now - for future upgrades or if you want to "upgrade" to a previous version that too should now work.

@j-tag
Copy link
Author

j-tag commented Apr 20, 2024

Thank you @Josh-Walker-GM . As you suggested the problem was in the upgrade command itself, so running upgrade throws the same error but also updated the files. So after re-running rw upgrade once more, the error is fixed. because now changes to files are applied and the upgrade command is using your new fix.
Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants