In the root of your project, there should be a folder called
.sfdx
In there you will find a folder called
orgs
And in there will be a folder for each org you are pushing to. Inside each of those folders you will find a file called
sourcePathInfos.json
This file is where SFDX keeps track of what files it knows about, when they were last edited, what type of thing they are, etc etc etc
To fix your problem, you can do one of two things:
Find and replace all instances of
force-app/main/default/aura/force-app/main/default/aura/
in that file with
force-app/main/default/aura/
if you're on Windows you may need to swap the / with \\ but you'll be able to see what you need when you open the file. Once that's done you can do
sfdx force:source:push -u <your alias>
and it should succeed.
Alternatively you can just delete the entire file, and do
sfdx force:source:push -u <your alias>
Note: This will cause your whole project to be pushed rather than just changes, but afaict that just makes it slower - it doesn't break anything (or hasn't for me)
I've done it both ways and still haven't decided which is faster/easier. It would be nice if there was an sfdx cli command to re-scan the directory rather than having to do this by hand, but I've not found it yet...
For now, you need to have the pre-release version installed for DX:
sfdx plugins:install salesforcedx@pre-release
Make sure you've also updated all extensions, including Lightning Web Components, which is not currently part of the Salesforce Extension Pack.
Often, simply restarting after installing/updating all extensions and the pre-release sfdx plugin will automatically create the lwc folder for you. You may also need to close and re-open the folder for it to take effect. I'm not sure how/why my lwc folder appeared, but it wasn't obvious as to what I did.
If all else fails, create a new project in a new, empty directory, and copy the lwc folder back into force-app/main/default/
, so that it has two files:
./force-app/main/default/lwc/.eslintrc.json
./force-app/main/default/lwc/jsconfig.json
Once you've done that, you'll stop getting that error and be able to create new components. These config files may require modification if you copy from a new project, so make sure you check the file paths of jsconfig.json. Every time you create a new component with sfdx, jsconfig.json will be updated with more metadata, so make sure you commit this file if you're using a repo.
NOTE: Even though you'll be able to create files locally, to push to the server, you need a pre-release org for now, since all new LWC features are tied to API 45.0 and later, while all production and scratch orgs will be 44.0.
Best Answer
https://github.com/forcedotcom/salesforcedx-vscode/issues/253
Using that issue discussion as reference. I would check that you don't have some package.json file without any name attribute in the root folder of the system directory.
Otherwise, even adding package.json with the name attribute seems to be the other suggested workaround