ionic-team / vscode-extension

15 stars 0 forks source link

npm outdated is being called with a project that uses pnpm #121

Closed dtarnawsky closed 1 year ago

dtarnawsky commented 1 year ago

This issue has been resolved in v1.45.4 where pnpm outdated and pnpm list are now being used when pnpm is used as the package manager.

oweitman commented 1 year ago

In Version 1.48.0 the error still/again exists if i downgrade to 1.45.4 the error is gone please reopen

[error] Unable to run 'npm outdated --json'. Try reinstalling node modules.

dtarnawsky commented 1 year ago

Hey @oweitman, I'm having a hard time reproducing an issue with 1.48.0. Are you able to supply a sample project with the problem? (you can send to damian at ionic.io)

oweitman commented 1 year ago

hi,

yes it is easy:

[error] Unable to run 'npm outdated --json'. Try reinstalling node modules.

this error is repeated everytime i select a different command in the ionic extension

versions: vscode Version: 1.80.2 (user setup) Commit: 2ccd690cbff1569e4a83d7c43d45101f817401dc Date: 2023-07-27T20:40:28.909Z Electron: 22.3.14 ElectronBuildId: 22695494 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045

ionic extension: v1.48.0

if you need more informations, please comment if i should upload the sources to github, no problem, but the source are unchanged from your scaffolding process

dtarnawsky commented 1 year ago

Thanks, can you runionic -v and see what version of the Ionic CLI you are using?

Also, if you try this by creating the project with the VS Code extension does it work?

oweitman commented 1 year ago

ionic CLI is 7.1.1

if i try the extension wizard to create a project, i noticed other problems

dtarnawsky commented 1 year ago

Hi @oweitman, just an FYI: version 1.49.0 is out and fixes the errors related to creating a new project on a Window machine.

I saw that you have https://github.com/ionic-team/vscode-extension/issues/129 open, and i'll use that to see if there is a fix related to your test steps.

danbaechtold commented 1 year ago

I (still) have the same error.

My setup is as follows: I'm using PNPM and the Capacitor app is in a subfolder "/app", with it's own package.json and pnpm-lock.yaml file.

The Ionic Extension correctly discovers the subfolders as projects, but still tries to use NPM instead of PNPM.

dtarnawsky commented 1 year ago

Hi @danbaechtold, are you able to provide a sample reproduction of a project with the problem? Also, does the root folder contain a package-lock.json file which may cause the extension to think you are using npm?

danbaechtold commented 1 year ago

Hi @dtarnawsky,

No, the root folder does not contain a package-lock.json.

Unfortunately it's a client's project, so I can't, but it's simple to reproduce:

  1. Use VSCode and the Extension to create a new project (I've chosen with Vue)
  2. Close VSCode, delete package-lock.json and node_modules
  3. Move all the files and folders to a subfolder, for example "app" (except .git, .vscode folders)
  4. Reopen VSCode; Make sure PNPM is the default package manager to execute scripts (search for "Npm: Package Manager" in Settings)
  5. Run pnpm install
  6. Open the the Ionic Extension

The error will then appear in the extension's output/console: [error] Unable to run 'npm outdated --json'. Try reinstalling node modules.

dtarnawsky commented 1 year ago

Thanks for details @danbaechtold , this issue is now fixed in version 1.55 released today. You would normally setup pnpm with workspaces to do this but now the extension also understands if you are just using a folder based structure with subfolders that are pnpm based.

danbaechtold commented 1 year ago

@dtarnawsky Awesome thank, works! :)