Skip to content

Error npm installing prettier after updating prettier version #1750

Closed
@DavidGregory084

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?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions