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(pnpm): devDependencies aren’t updated if pnpm package manager #468

Open
Kristinita opened this issue Sep 21, 2022 · 1 comment
Open

Comments

@Kristinita
Copy link

Kristinita commented Sep 21, 2022

1. Summary

I don’t understand how can I update my devDependencies to the latest versions using pnpm + npm-check. If I follow the steps described in the npm-check descriptions, this command is launched:

pnpm npm-check -y install <devDependency>@<latest version> --save-dev --color=always

while the command to get the desired behavior looks like this:

pnpm add <devDependency>@<latest version> -D

It seems like npm-check is using some deprecated pnpm syntax.

2. MCVE

2.1. Task

I wish to update all of my devDependencies except for a some. Currently, this cannot be done using pnpm without third-party tools.

In my MCVE, I want to update to the latest version of obsolete devDependencies “coffeescript” and “postcss”, but not update “imagemin-webp” (because the latest version of this package doesn’t work correctly for me with Node.js 18, and I don’t want to update it).

2.2. Files

This configuration on the KiraPnpmPackagesUpdate branch of my GitHub repository for demonstrations, Travis CI build for this configuration.

  1. packages.json:

    {
    	"devDependencies": {
    		"coffeescript": "^1.0.0",
    		"imagemin-webp": "^6.0.0",
    		"postcss": "^6.0.0"
    	}
    }
  2. The part of the .travis.yml:

    before_install:
    # [INFO] Set environment variable “NPM_CHECK_INSTALLER” for pnpm:
    # https://github.com/dylang/npm-check#update-using-ied-or-pnpm
    - export NPM_CHECK_INSTALLER="pnpm npm-check -y"
    
    install:
    - npm install -g pnpm
    # [INFO] Install all devDependencies from “package.json”:
    # https://pnpm.io/cli/install#--dev--d
    - pnpm install -D
    # [INFO] Install npm-check as devDependency:
    # https://pnpm.io/cli/add#--save-dev--d
    - pnpm add npm-check -D
    
    script:
    # [INFO] Execute npm-check in scope of a project:
    # https://pnpm.io/cli/exec
    - pnpm exec npm-check -y -i imagemin-webp
    

3. Behavior

3.1. Desired

Like this command:

pnpm add coffeescript@2.7.0 postcss@8.4.16 -D

This command updates devDependencies “coffeescript” and “postcss” to the latest versions, but does nothing with “imagemin-webp”.

3.2. Current

Travis link:

$ pnpm exec npm-check -y -i imagemin-webp

- Checking for unused packages. --skip-unused if you don't want this.

- Checking npm registries for updated packages.

$ pnpm npm-check -y install coffeescript@2.7.0 postcss@8.4.16 --save-dev --color=always

- Installing using pnpm npm-check -y…

Command failed with ENOENT: pnpm npm-check -y install coffeescript@2.7.0 postcss@8.4.16 --save-dev --color=always

spawn pnpm npm-check -y ENOENT

For more detail, add `--debug` to the command

The command "pnpm exec npm-check -y -i imagemin-webp" exited with 1.

As you can see this command is running:

pnpm npm-check -y install coffeescript@2.7.0 postcss@8.4.16 --save-dev --color=always

4. Environment

  1. Operating system:

    1. Local — Microsoft Windows [Version 10.0.19041.1415]
    2. Travis CI — Ubuntu 22.04 LTS Jammy Jellyfish
  2. Node.js v18.9.0

  3. pnpm 7.11.0

  4. npm-check 6.0.1

Thanks.

@Kristinita
Copy link
Author

@zkochan, please take a look at this issue when you will have a time.

In 2018 you wrote in comments of your pull request to npm-check:

Command failed: yarn install --save @types/node@10.5.0 --color=always
error `install` has been replaced with `add` to add new dependencies. Run "yarn add @types/node@10.5.0" instead.

Currently, in 2022 pnpm uses add, not install to add new dependencies. But it looks like npm-check use deprecated pnpm syntax.

Thanks.

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

No branches or pull requests

1 participant