Skip to content

Error npm installing prettier after updating prettier version #1750

Closed

Description

@DavidGregory084

I'm trying to update the version of prettier used in a VS Code plugin.

Currently I'm using the default version of prettier that's installed by spotless - this seems to be version 2.8.1.

If I update my spotless configuration to use version 3.0.0, which definitely exists on npm, I get an npm install error, which indicates No matching version found for prettier@3.0.0.

Gradle version: 8.2.1
Spotless version: 6.19.0

Spotless configuration:

spotless {
    ratchetFrom("origin/main")

    typescript {
        target("src/**/*.ts")
        prettier("3.0.0")
    }

    json {
        target("syntaxes/**/*.json")
        prettier("3.0.0")
    }
}

Command output:

❯ ./gradlew spotlessApply --stacktrace

> Task :vscode-plugin:spotlessTypescript FAILED
Step 'prettier-format' found problem in 'src/extension.ts':
Running npm command 'NpmInstall in /Users/davidgregory/Repos/mina/vscode-plugin/build/spotless-prettier-node-modules-77f2ce42f0ac73e094a458a6f7a35c38 [/usr/local/bin/npm install --no-audit --no-fund --prefer-offline]' failed with exit code: 1

> arguments: [/usr/local/bin/npm, install, --no-audit, --no-fund, --prefer-offline]
> exit code: 1
>    stdout: (below)
> npm ERR! code ETARGET
> npm ERR! notarget No matching version found for prettier@3.0.0.
> npm ERR! notarget In most cases you or one of your dependencies are requesting
> npm ERR! notarget a package version that doesn't exist.
> 
> npm ERR! A complete log of this run can be found in: /Users/davidgregory/.npm/_logs/2023-07-12T10_00_48_165Z-debug-0.log

com.diffplug.spotless.npm.NpmProcessException: Running npm command 'NpmInstall in /Users/davidgregory/Repos/mina/vscode-plugin/build/spotless-prettier-node-modules-77f2ce42f0ac73e094a458a6f7a35c38 [/usr/local/bin/npm install --no-audit --no-fund --prefer-offline]' failed with exit code: 1

> arguments: [/usr/local/bin/npm, install, --no-audit, --no-fund, --prefer-offline]
> exit code: 1
>    stdout: (below)
> npm ERR! code ETARGET
> npm ERR! notarget No matching version found for prettier@3.0.0.
> npm ERR! notarget In most cases you or one of your dependencies are requesting
> npm ERR! notarget a package version that doesn't exist.
> 
> npm ERR! A complete log of this run can be found in: /Users/davidgregory/.npm/_logs/2023-07-12T10_00_48_165Z-debug-0.log

Here's a gist of the log file mentioned in that message.

Strangely, if I run npm install manually in the temporary directory build/spotless-prettier-node-modules-77f2ce42f0ac73e094a458a6f7a35c38/, that fixes the issue, even after using ./gradlew clean to wipe out the build directory, but I've experienced this on two different machines now, so it's sort of reproducible as long as you don't do that.

Possibly something to do with the arguments to npm install, or npm caching?

Activity

  1. self-assigned this
    on Jul 12, 2023
  2. added 3 commits that reference this issue on Jul 18, 2023
    020187b
    dab5f9d
    8187042
  3. nedtwigg commented on Sep 1, 2023

    @nedtwigg
    Member

    Released in plugin-gradle 6.21.0 and plugin-maven 2.38.0.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions