Closed sgriner closed 4 years ago
Did you add any configuration for the local dev server, such as localdevserver.config.json
?
No. I just did a clone from the lwc-recipes repository, and didn't change anything.
I have the same issue whilst trying to start the local dev server.
Version: 7.41.0-2a5f766389 / macOS: 10.15.1
I've done a bit of digging and from what I can tell this is a bug in the plugin. modulePaths is built using require.resolve.paths('.'), this returns various directories but can also return the node binary - the node binary is not a directory hence the error. There is a check that the various modulePaths exist but not that they are a directory.
Obviously, I wouldn't advocate making changes to files in node_modules or dist files because we all know thats a terrible idea for so many reasons. However, if you were to want a quick hack just to get the local dev server up and running to have a play around (whilst the Salesforce dev team apply a proper fix)... the file to look in is: ~/.local/share/sfdx/node_modules/@salesforce/lwc-dev-server/dist/server/LocalDevServer.js.
I added the following line:
modulePaths = modulePaths.filter(path => fs_1.default.lstatSync(path).isDirectory());
below:
modulePaths = modulePaths.filter(fs_1.default.existsSync);
(in the 'start' method)
All it does is filters out any module paths that are not directories.
Thanks @gdman! That works great, as a temporary workaround.
Thanks guys, we've filed a work item for this W-7151906 and will pick it up soon.
This issue has been automatically marked as type:bug-p3
because it has not had recent activity.
@sgriner @gdman - The latest lwc-dev-server version (2.1.0) fixes this. Thanks for reporting the issue!
Summary
Unable to start local dev server.
Steps To Reproduce:
Expected result
Local dev server should start on port 3333.
Actual result
VS Code Version: 1.39.2
SFDX CLI Version: sfdx-cli/7.30.13-9e204762d5 darwin-x64 node-v10.15.3
OS and version: macOS 10.15.1