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.
In general, the local development for Lightning Web Components still has beta status: Local Development (Beta)
However, even the beta version can now be used relatively reliably. To set up local development you only need to authorize an org and install the development server. This allows you to develop locally without the need to push your components to an org first.
The local development server and its configuration are provided by a Salesforce CLI plugin. Before you install the plugin make sure you are using the latest Salesforce CLI version by running:
sfdx update
Then the lwc-dev-server
plugin can be installed as follows:
sfdx plugins:install @salesforce/lwc-dev-server
After installing the plugin, to start the server on http://localhost:3333
and access all components of the project just run:
sfdx force:lightning:lwc:start
There is even a short official guide on how to set it up: Set Up LWC Local Development