forcedotcom / cli

Salesforce CLI
https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/
BSD 3-Clause "New" or "Revised" License
493 stars 78 forks source link

wrong version of `prettier-plugin-apex` in `force:lightning:lwc:test:setup` #1334

Closed qayshp closed 1 year ago

qayshp commented 2 years ago

Summary

wrong version of prettier-plugin-apex in force:lightning:lwc:test:setup.

Steps To Reproduce:

  1. sfdx force:project:create --projectname fizzbuzz
  2. cd fizzbuzz/force-app/main/default/aura
  3. sfdx force:lightning:app:create --appname foobar
  4. sfdx force:lightning:lwc:test:setup

Expected result

Describe what should have happened.

The project should have been created with 1.10.0, the latest published version.

Actual result

Describe what actually happened.

```"prettier-plugin-apex": "^1.10.1"``` ``` sfdx force:lightning:lwc:test:setup One or more of the following package.json scripts already exists, skipping adding of test scripts: "test:unit", "test:unit:debug", "test:unit:watch" Jest configuration found in jest.config.js. Skipping creation of new config file. Updating files... logFileUpdatesEnd Installing @salesforce/sfdx-lwc-jest node package... npm ERR! code ETARGET npm ERR! notarget No matching version found for prettier-plugin-apex@^1.10.1. 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: npm ERR! /Users/qpoonawala/.npm/_logs/2021-12-17T19_26_40_492Z-debug-0.log ERROR running force:lightning:lwc:test:setup: Error installing @salesforce/sfdx-lwc-jest: 'Command failed: npm install --save-dev @salesforce/sfdx-lwc-jest' ```

System Information

`sfdx-cli/7.131.0 darwin-x64 node-v16.13.1` ``` sfdx version --verbose --json { "cliVersion": "sfdx-cli/7.131.0", "architecture": "darwin-x64", "nodeVersion": "node-v16.13.1", "pluginVersions": [ "@oclif/plugin-autocomplete 0.3.0 (core)", "@oclif/plugin-commands 1.3.0 (core)", "@oclif/plugin-help 3.2.10 (core)", "@oclif/plugin-not-found 1.2.4 (core)", "@oclif/plugin-plugins 1.10.10 (core)", "@oclif/plugin-update 1.5.0 (core)", "@oclif/plugin-warn-if-update-available 1.7.3 (core)", "@oclif/plugin-which 1.0.3 (core)", "@salesforce/sfdx-plugin-lwc-test 0.1.7 (core)", "alias 1.2.0 (core)", "apex 0.5.0 (core)", "auth 1.8.0 (core)", "config 1.3.2 (core)", "custom-metadata 1.0.12 (core)", "data 0.6.6 (core)", "generator 1.2.1 (core)", "info 1.1.4 (core)", "limits 1.3.0 (core)", "org 1.11.0 (core)", "salesforce-alm 53.6.0 (core)", "schema 1.1.0 (core)", "sfdx-cli 7.131.0 (core)", "source 1.6.2 (core)", "telemetry 1.4.0 (core)", "templates 52.6.0 (core)", "trust 1.1.0 (core)", "user 1.7.0 (core)" ], "osVersion": "Darwin 20.6.0" } ```

Additional information

I haven't gone through the process of making this bug report fit the template perfectly (ie by creating a test repository with the failure). If you need to decline it, ¯\_(ツ)_/¯

github-actions[bot] commented 2 years ago

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

qayshp commented 2 years ago

For reference, https://github.com/dangmai/prettier-plugin-apex/releases shows 1.10.0 as latest.

github-actions[bot] commented 2 years ago

We have determined that the issue you reported exists in code owned by another team that uses only the official support channels. To ensure that your issue is addressed, open an official Salesforce customer support ticket with a link to this issue. We encourage anyone experiencing this issue to do the same to increase the priority. We will keep this issue open for the community to collaborate on.

uip-robot-zz commented 2 years ago

This issue has been linked to a new work item: W-10338858

nolanlawson commented 2 years ago

I tried the steps to reproduce but could not reproduce. Here are my node and npm versions:

$ node --version
v14.17.3
$ npm --version
6.14.13

Also, the project @salesforce/sfdx-lwc-jest does not have any dependency on prettier-plugin-apex (nor a transitive dependency – I checked using yarn why prettier-plugin-apex). So if prettier-plugin-apex is causing problems, it may be declared in some other package.json file.

@qayshp Could you check on your end to see if the problem is resolved? Thanks!

SCWells72 commented 2 years ago

This happens to me every time I create a new project using the CLI. The steps to reproduce are simple:

$ node --version
v14.18.0

$ npm --version
8.3.2

$ sfdx force:project:create -d . -n prettier_bad_version
target dir = C:\Users\Scott\projects
   create prettier_bad_version\config\project-scratch-def.json
   create prettier_bad_version\README.md
   create prettier_bad_version\sfdx-project.json
   create prettier_bad_version\.husky\pre-commit
   create prettier_bad_version\.vscode\extensions.json
   create prettier_bad_version\.vscode\launch.json
   create prettier_bad_version\.vscode\settings.json
   create prettier_bad_version\force-app\main\default\lwc\.eslintrc.json
   create prettier_bad_version\force-app\main\default\aura\.eslintrc.json
   create prettier_bad_version\scripts\soql\account.soql
   create prettier_bad_version\scripts\apex\hello.apex
   create prettier_bad_version\.eslintignore
   create prettier_bad_version\.forceignore
   create prettier_bad_version\.gitignore
   create prettier_bad_version\.prettierignore
   create prettier_bad_version\.prettierrc
   create prettier_bad_version\jest.config.js
   create prettier_bad_version\package.json

$ cd prettier_bad_version/

$ grep prettier-plugin-apex package.json
    "prettier-plugin-apex": "^1.10.1"

$ npm install
npm ERR! code ETARGET
npm ERR! notarget No matching version found for prettier-plugin-apex@^1.10.1.
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:
npm ERR!     C:\Users\Scott\AppData\Local\npm-cache\_logs\2022-01-26T14_22_23_251Z-debug-0.log