Navigation Menu

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" doesn't work as expected with workspaces #5363

Closed
livemixlove opened this issue Sep 16, 2022 · 6 comments · Fixed by #5547
Closed

"pnpm install" doesn't work as expected with workspaces #5363

livemixlove opened this issue Sep 16, 2022 · 6 comments · Fixed by #5547

Comments

@livemixlove
Copy link

pnpm version:

7.11.0

Code to reproduce the issue:

https://github.com/livemixlove/pnpm_workspace_issue

Expected behavior:

pnpm install should find workspaces and install based on package_a and package_b package.json files and create a pnpm-lock.yaml (right?). I would expect two different versions of react and @types/react to get installed.

Actual behavior:

#pnpm install
Already up to date

No lock file is created, no node_modules is created. Is there some special order of commands I need to run when setting up workspaces?

The only thing that has an effect is:

cd package_a
pnpm install some_new_package

This creates a pnpm-lock.yaml in the root directory reflecting package_a package.json. If I repeat this for package_b, then I finally get a pnpm-lock.yaml that I would expect from pnpm install (run in root dir). Except of course, I had to install a new npm package in each directory, so it's a clunky workaround.

Additional information:

  • node -v prints:

  • node -v
    v12.22.9

  • Windows, macOS, or Linux?:

  • Ubuntu 22.04

@livemixlove livemixlove changed the title pnpm install doesn't work as expected with workspaces pnpm install doesn't work as expected with workspaces Sep 16, 2022
@livemixlove livemixlove changed the title pnpm install doesn't work as expected with workspaces "pnpm install" doesn't work as expected with workspaces Sep 16, 2022
@mjgerace
Copy link

@zkochan @livemixlove this is a duplicate or similar to the issue I am describing here: #5372

Something has to be going on with a recent build due to number of reports... I have a lot of depth in my explanation.

@zkochan
Copy link
Member

zkochan commented Sep 22, 2022

I don't think it is the same issue.

@livemixlove your workspace will work with this pnpm-workspace.yaml file:

packages:
  - package_a
  - package_b

@livemixlove
Copy link
Author

Thanks for the responses! I think I misunderstood how that paths in pnpm-workspace.yaml were being used. So this is possibly not a bug. Though it's still curious that my workaround works as I expected.

It might be an improvement to change "Already up to date" to something like "No workspace packages found, check that pnpm-workspace.yaml matches your directory structure."

@zkochan
Copy link
Member

zkochan commented Sep 22, 2022

Sounds good.

@livemixlove
Copy link
Author

Thanks for the responses! I think I misunderstood how that paths in pnpm-workspace.yaml were being used. So this is possibly not a bug. Though it's still curious that my workaround works as I expected.

It might be an improvement to change "Already up to date" to something like "No workspace packages found, check that pnpm-workspace.yaml matches your directory structure."

@saeedhabibi
Copy link

The error you're encountering is related to the execution policy settings in PowerShell on your system. Due to security concerns, running scripts in PowerShell might be restricted with the default settings.

To resolve this issue and allow script execution in PowerShell, you can change the Execution Policy settings. The recommended approach is to use PowerShell with "Administrator" privileges.

To do this, you can run the following command in PowerShell with "Administrator" access:
Set-ExecutionPolicy RemoteSigned

After executing this command, your system might prompt you to confirm whether you're sure you want to make these changes. If prompted, type "Y" and press Enter.

Once you've made these adjustments, try installing pnpm again and check if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants