forcedotcom / lwc-dev-server-feedback

LWC Local Development
BSD 3-Clause "New" or "Revised" License
45 stars 10 forks source link

Problem installing LWC Dev Server component on Visual Code #163

Open oelizon opened 1 year ago

oelizon commented 1 year ago

Hello in Visual Code, when I try this instruction : sfdx plugins:install @salesforce/lwc-dev-server

I get this error message (after the line). Could you please help to resolve this please ?

Installing plugin @salesforce/lwc-dev-server... failed Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive --mutex=file:/Users/oelizon/.local/share/sfdx/yarn.lock --preferred-cache-folder=/Users/oelizon/Library/Caches/sfdx/yarn --check-files exited with code 127

Full Log :

Installing plugin @salesforce/lwc-dev-server... ⡿ [4/4] Building fresh packages... error /Users/oelizon/.local/share/sfdx/node_modules/fibers: Command failed. Exit code: 127 Command: node build.js || nodejs build.js Arguments: Directory: /Users/oelizon/.local/share/sfdx/node_modules/fibers Output: node-gyp not found! Please ensure node-gyp is in your PATH-- Try running: sudo npm install -g node-gyp /bin/sh: nodejs: command not found Installing plugin @salesforce/lwc-dev-server... ⣽ info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command. warning Error running install script for optional dependency: "/Users/oelizon/.local/share/sfdx/node_modules/cpx/node_modules/fsevents: Command failed. Exit code: 1 Command: node install.js Arguments: Directory: /Users/oelizon/.local/share/sfdx/node_modules/cpx/node_modules/fsevents Output: node:events:491 throw er; // Unhandled 'error' event ^

Error: spawn node-gyp ENOENT at ChildProcess._handle.onexit (node:internal/child_process:283:19) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) Emitted 'error' event on ChildProcess instance at: at ChildProcess._handle.onexit (node:internal/child_process:289:12) at onErrorNT (node:internal/child_process:476:16) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -2, code: 'ENOENT', syscall: 'spawn node-gyp', path: 'node-gyp', spawnargs: [ 'rebuild' ] } Installing plugin @salesforce/lwc-dev-server... failed Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive --mutex=file:/Users/oelizon/.local/share/sfdx/yarn.lock --preferred-cache-folder=/Users/oelizon/Library/Caches/sfdx/yarn --check-files exited with code 127

meeple-bot commented 1 year ago

I also got this issue. Did yours ever resolve?

oelizon commented 1 year ago

No, not yet.

Olivier ELIZON

Program Architect | Salesforce

3 avenue Octave Gréard

75007 Paris

Mobile : +33 7 61 97 87 48

http://salesforce.com/fr/signature

Le lun. 10 juil. 2023 à 18:30, meeple-bot @.***> a écrit :

I also got this issue. Did yours ever resolve?

— Reply to this email directly, view it on GitHub https://github.com/forcedotcom/lwc-dev-server-feedback/issues/163, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBBHXYJTTIGEMT2OHPI2F5DXPQUZVANCNFSM6AAAAAAZ554TXM . You are receiving this because you authored the thread.Message ID: @.***>

lumacerqueira commented 1 year ago

you need to run npm install -g node-gyp

Ko-Sit commented 1 year ago

Deleting the content of referenced directory worked for me (sf cli 2.0) /Users/kosit/.local/share/sf/

--mutex=file:/Users/oelizon/.local/share/sfdx/yarn.lock

jweston491 commented 8 months ago

I am having the same issue.

steinwinde commented 7 months ago

you need to run npm install -g node-gyp

@lumacerqueira - thanks! I had a very similar problem like the OP and this fixed it for me. But how did you know, where is this documented? Is there any more pertinent installation instruction than https://developer.salesforce.com/tools/vscode/en/localdev/set-up-lwc-local-dev ?

SecretBros commented 7 months ago

you need to run npm install -g node-gyp

still having same issuse

stale[bot] commented 6 months ago

This issue has been automatically marked as type:bug-p3 because it has not had recent activity.

TomSesselmann commented 6 months ago

So running the problematic yarn add @salesforce/lwc-dev-server@latest command using Node 18 seems to work, but it doesn't work with Node 20. And it looks like the version of Node.js bundled in the Salesforce CLI was upgraded to v20 in the 2.16.7 (Nov 8, 2023) release. I managed to get plugin installed correctly when using a version of the CLI before this update.

Torsen commented 5 months ago

I'm having the same issue. Does anyone find a solution?

theevenator commented 3 months ago

Found a solution that worked for me. It seems the issue stems from using node v20 for some reason with this plugin. I used nvm to downgrade to 18.17.0 nvm install 18.17.0, had to re install the sf CLI using npm npm install @salesforce/cli --global and then ran sf plugins install @salesforce/lwc-dev-server which installed successfully @salesforce/cli: Installing plugin @salesforce/lwc-dev-server@latest... installed v2.11.0