Building web component via cli works only once
Version
3.5.0
Environment info
System:
OS: macOS 10.14.3
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: Not Found
npm: 6.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 72.0.3626.121
Firefox: Not Found
Safari: 12.0.3
npmGlobalPackages:
@vue/cli: 3.5.1
Steps to reproduce
On a brand new vue cli project created with vue create I want to run a vue web component bundler. I run npx vue-cli-service build --target wc --name my-element *.vue from src folder and it compiles nicely. After that, every next try ends up with 404error from https://registry.npmjs.org/vue-cli-service.
It runs again after I remove package-lock and node_modules and npm install:
rm -rf node_modules package-lock.json && npm install
What am I doing wrong ?

What is expected?
to rebuild web component every time I want it
What is actually happening?
it runs only once, on a clean project and then got error 404 every next time
removing package-lock and node_modules , then 'npm install' helps
Can't reproduce this. Can you share a repository to reproduce it better maybe?
Ofcourse, every time :). Check out my repo: https://github.com/raibait/vue-web-cpnt-bug
The root cause here:
The npx command was run in the src/ directory.
And the default cache folder is node_modules/.cache (relative to process.cwd()). So after running this command, a src/node_modules/.cache folder was created.
So when the npx command was run for the second time, it found a node_modules directory in the current working directory and stopped looking up in the upper-level directory. Of course, npx couldn't find the vue-cli-service command in the current directory, so it tried to download from the npm registry.
But as there's no corresponding package name for this command, a 404 would be returned.
There's little we can do for this issue. Maybe adding a warning when vue-cli-service is called in a directory without package.json?