Npm Vue Cli Service Serve

Posted on  by admin
I think you are using cmd in windows.

Try deleting the node_modules folder and after that run npm i from the cmd. Then try running npm run serve again and see if it works this time. This will install global npm package. @vue/cli-service is usully installed as global, because you do not usually copy these types of packages to every project.

If the global npm package gets corrupted, it is not stored in node_modules folder, but rather in other depending on the os. Therefore removing node_modules does not help. Locations for global node_modules folders are %USERPROFILE%\AppData\Roaming\npm\node_modules (Win10) or /usr/local/lib/node_modules (Linux) Check this stack overflow post on how to locate global packages.

Hiws
7,424

if you are using yarn run yarn or yarn install and then yarn serve. if you are using npm run npm install and then npm run serve.

I do not know what changed but my VueJS application hangs when I start the development server. It hangs at 41% now for over 12 hours…. My package.json file is as below. Inside a Vue CLI project, @vue/cli-service installs a binary named vue-cli-service.

You can access the binary directly as vue-cli-service in npm scripts, or as ./node_modules/.bin/vue-cli-service from the terminal. This is what you will see in the package.json of a project using the default preset:. You can invoke these scripts using either npm or Yarn:. If you have npx available (should be bundled with an up-to-date version of npm), you can also invoke the binary directly with:.

You can run scripts with additional features using the GUI with the vue ui command.

Here is the Webpack Analyzer from the GUI in action:. Copying to clipboard might not work on a few platforms.If copying was successful, (copied to clipboard) is displayed next to the local dev server URL. The vue-cli-service serve command starts a dev server (based on webpack-dev-server) that comes with Hot-Module-Replacement (HMR) working out of the box.

In addition to the command line flags, you can also configure the dev server using the devServer field in vue.config.js.

[entry] in the CLI command is defined as the entry file, not an additional entry file. If you overwrite the entry in the CLI, then the entries from config.pages are no longer considered, which may cause an error.

vue-cli-service build produces a production-ready bundle in the dist/ directory, with minification for JS/CSS/HTML and auto vendor chunk splitting for better caching.

The chunk manifest is inlined into the HTML. There are a few useful flags:. --modern builds your app using Modern Mode, shipping native ES2015 code to modern browsers that support it, with auto fallback to a legacy bundle.

--target allows you to build any component(s) inside your project as a library or as web components.

See Build Targets for more details.

Sølve TornøeSølve Tornøe
3,5311

See Inspecting Webpack Config for more details. Some CLI plugins will inject additional commands to vue-cli-service.

For example, @vue/cli-plugin-eslint injects the vue-cli-service lint command.
6

Not the answer you're looking for? Browse other questions tagged javascriptnode.jsvue.jsvuejs2 or ask your own question.