function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Iago SilvaIago Silva 

Local Development Server for Lightning Web Components

I'm trying to set a Local Development Server for Lightning Web Components according to this link but when I try to install the plugin @salesforce/lwc-dev-server I get this error message :
Code: ShellParseError

and a .js file named npm-cli.js opens in my editor with this content:
#!/usr/bin/env node 
require('../lib/cli.js')(process)

Anyone knows what to do? Thanks in advance.
Best Answer chosen by Iago Silva
Keegan McCormack 1Keegan McCormack 1
Iago, I had the exact same issue and actually resolved with just updating then trying again, i.e.
sfdx update
sfdx plugins:install @salesforce/lwc-dev-server
After update got a more meaningful error (dependency missing 'node-gyp not found! Please ensure node-gyp is in your PATH--'). Which was resolved with just installing it
npm install -g node-gyp

 

All Answers

AbhinavAbhinav (Salesforce Developers) 
Check this:

https://developer.salesforce.com/tools/vscode/en/localdev/set-up-lwc-local-dev

Troubleshooting Tip: Due to a known issue, it’s likely you’ll see several errors when you install the plug-in. Run sfdx plugins --core to see if the plug-in is installed. If yes, try to start the Local Development server. If successful, you’re good to proceed.

You can follow below video link as well to set up.

https://www.youtube.com/watch?v=8eRFE4t2VyU

Thanks!
Iago SilvaIago Silva
Hi Abhinav,

I run sfdx plugins --core and the lwc-dev-server plugin is not installed. I also followed the instructions shown in the video you mentioned but didn't work. It gives the same error when trying to install the plugin.
denisse Solisdenisse Solis
Yes you are right (https://getforfashion.com/best-skin-tightening-food-complete-guide/) and cleared the ambiguities
Keegan McCormack 1Keegan McCormack 1
Iago, I had the exact same issue and actually resolved with just updating then trying again, i.e.
sfdx update
sfdx plugins:install @salesforce/lwc-dev-server
After update got a more meaningful error (dependency missing 'node-gyp not found! Please ensure node-gyp is in your PATH--'). Which was resolved with just installing it
npm install -g node-gyp

 
This was selected as the best answer
Iago SilvaIago Silva
Hi Keegan, thank you for you response.

I run
sfdx update
sfdx plugins:install @salesforce/lwc-dev-server

and now I have the following error:
 
Installing plugin @salesforce/lwc-dev-server... failed
    Error: yarn add @salesforce/lwc-dev-server@latest --non-interactive --mutex=file:C:\Users\Nescara\AppData\Local\sfdx\yarn.lock 
    --preferred-cache-folder=C:\Users\Nescara\AppData\Local\sfdx\yarn --check-files exited with code 1
Iago SilvaIago Silva
Hi Keegan, Denisse and Abhinav

I don't know how but now I'm able to use local lwc development. I just tried again these days and now it works. Even so, thank you for your answers.
Thomas Lee 27Thomas Lee 27
Hi Iago, I'm getting the same error as the one you displayed when trying to install the plugin. How were you able to resolve the issue?