Npm run serve vue ошибка

I am getting an error when trying to run npm run serve. At first I installed node.js then vue as well as vue/cli.
But when I am trying to run server as -> npm run serve at that time I’m getting error like ‘vue-cli-service’ is not recognized as an internal or external command.

I used below codes for installation:

npm install -g vue
npm install -g @vue/cli

enter image description here

can someone guide me what to do to solve this issue ?

asked Oct 27, 2019 at 13:27

Dcoder14's user avatar

Dcoder14Dcoder14

1,8313 gold badges12 silver badges22 bronze badges

3

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

answered Oct 27, 2019 at 14:44

s4k1b's user avatar

s4k1bs4k1b

2,9551 gold badge7 silver badges14 bronze badges

7

Install vue/cli-service globally

npm install @vue/cli-service -g

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.

answered May 26, 2020 at 15:14

Scholtz's user avatar

ScholtzScholtz

2,9182 gold badges23 silver badges23 bronze badges

2

it will depend on the package manager you are using

  1. delete node_modules

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

  3. if you are using npm run npm install and then npm run serve

answered Aug 29, 2020 at 13:40

Clarance Liberiste Ntwari's user avatar

In my case, the package @vue/cli-service is installed in my local node_modules environment, but not my global environment, so it cannot be used as a command. I type .\node_modules\.bin\vue-cli-service serve and it works.

answered Apr 9, 2020 at 3:52

Lucien Zhang's user avatar

As it is mentioned in terminal that node_modules is missing from your project, so you can’t directly use npm run serve, first you have to do npm install then do npm run serve. It will work fine

answered Apr 18, 2020 at 12:45

Shubham Sharma's user avatar

1

In my case I ran below commands in GitBash and it worked fine

  1. npm install
  2. npm run serve

answered Oct 30, 2020 at 19:18

Kiran Modini's user avatar

  1. If you are using cmd in windows.
  2. deleting the node_modules folder and after that run npm istall from
    the cmd.
  3. run npm run serve and see if it works this time

answered Dec 17, 2020 at 16:25

Ali Raza's user avatar

Ali RazaAli Raza

6705 silver badges15 bronze badges

In my case, I have checked the folder of node_modules was missing. I am using Windows. So I run this in cmd.

  1. npm install
  2. npm run serve

Then I check it in localhost like usual.

answered Jun 19, 2021 at 21:31

ahartami's user avatar

This issue mostly happens when either @vue/cli is not installed or in most cases,

@vue/cli is already installed and you are currently working on a project and when running

  • yarn serve or npm run serve.

Most at times, this issue is been caused by broken dependencies.
to fix this issue, simple run

  • yarn install or npm install

depending on your package manager.

answered Aug 13, 2021 at 3:10

Romanric Akam's user avatar

Romanric AkamRomanric Akam

7331 gold badge5 silver badges13 bronze badges

well after trying all the solutions above and it still haven’t worked for you then you probably have a stupid space in the full directory of your Vue project like in my case. so remove that that space and it will work from then on.

answered Aug 28, 2021 at 20:51

Muhammad Kashif's user avatar

Remember to set the NODE_ENV=development and run npm install again

answered Sep 18, 2021 at 4:57

William Keller's user avatar

Try changing the project path to one without spaces, it worked on windows 10

answered Nov 12, 2021 at 16:15

Maher Fakhour's user avatar

I had faced the same problem in windows. Then
first I deleted the node_module. then I run npm install.

answered Nov 3, 2020 at 4:01

Hasibul-'s user avatar

Hasibul-Hasibul-

1,2021 gold badge9 silver badges18 bronze badges

For Windows you should modify package.json to:

  "scripts": {
    "serve": "vue-cli-service.cmd serve",
    "build": "vue-cli-service.cmd build",
    "lint": "vue-cli-service.cmd lint"
  }

,

answered Mar 22, 2021 at 20:30

Andrey -hidden-'s user avatar

I had the same issue using windows + WSL2 (Ubuntu 20.04). Looking at the logs generated after trying to run npm i I noticed that my WSL2 environment did not have python2 installed. So to solve I ran the following commands:

  1. sudo apt-get install python2
  2. rm -rf node_modules
  3. npm i
  4. npm run serve

answered May 3, 2021 at 10:38

Sales Lopes's user avatar

I faced the same in Windows. Had to run npm install again. Then it worked perfectly.

answered May 28, 2021 at 9:56

burke_'s user avatar

Wait, what’s the difference between @vue/cli and @vue/cli-service? When you install both, they show different number of packages installed. The latter solved my issue actually but everyone keeps saying install @vue/cli.

answered Aug 19, 2021 at 20:04

Justin Farrugia's user avatar

try running npm i or npm install and then proceed to run npm i vue after previous installation done. works for me

answered Jun 18, 2022 at 6:03

rubanero14's user avatar

you need use «npm install» at Command Line

answered Aug 27, 2022 at 16:39

Zest Zhang's user avatar

Zest ZhangZest Zhang

511 silver badge4 bronze badges

Before running «npm install», try running this command first:

npm set strict-ssl false

answered Nov 4, 2022 at 14:35

ShieldOfSalvation's user avatar

Like you, I got the error below when I ran npm run serve from the CMD command line,

‘vue-cli-service’ is not recognized as an internal or external
command, operable program or batch file.

I got past this familiar error by using the following command to add the npm folder to the PATH that CMD searches for executables:

path=%path%;C:\Users\<USERNAME>\AppData\Roaming\npm

where <USERNAME> is your Windows user profile directory name. Only then was I able to run the following commands successfully:

npm install 
npm run serve

answered Dec 9, 2022 at 20:20

ShieldOfSalvation's user avatar

What solved the issue for me was renaming the directory. I had used the symbol «&» on the folder name and it seems to break things, so changing it to «and» fixed the issue.

This will probably be an incredibly niche thing, but if I help even 1 person it’s fine by me.

answered Dec 30, 2022 at 22:15

N1h1l1sT's user avatar

N1h1l1sTN1h1l1sT

1051 silver badge11 bronze badges

I have a project, I can run it well on Linux, but i have the same issue on windows, I solve it this way (I hope in your case it works too):

  1. Delete the node_modules

  2. Install it again with npm i

Stefano Sansone's user avatar

answered Nov 2, 2021 at 13:59

Ismael Gomez's user avatar

1

Version

4.1.1

Environment info

System:
    OS: Windows 7 6.1.7601
    CPU: (4) x64 Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz
  Binaries:
    Node: 10.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 6.5.0 - C:\Program Files\nodejs\npm.CMD
  npmGlobalPackages:
    @vue/cli: Not Found

@vue/cli 4.1.1 is actually installed globally and vue command is available.

Steps to reproduce

Create a project using vue create
  • vue create my-project
Go the directory my-project
  • cd my-project
Run my-project with serve
  • npm run serve

What is expected?

The project should start in development mode with hot reload.

What is actually happening?

The command terminates without starting anything.
If we run vue serve instead of npm run serve, it errors out the following in the terminal and exits:

Failed to locate entry file in my/project/directory/path.
Valid entry file should be one of: main.js, index.js, App.vue or app.vue.

So I am assuming npm run serve tries to find either of the above mentioned files but is not able to find any and hence terminates. The reason is, none of the «entry» files are in the project’s root directory but inside the src directory.

I’ve got an issue when try running server for vue project

this is the issue

ERROR Error: No valid exports main found for
PROJECT PATH\node_modules\colorette’
Error: No valid exports main found for
PROJECT PATH\node_modules\colorette’
at resolveExportsTarget (internal/modules/cjs/loader.js:622:9)
at applyExports (internal/modules/cjs/loader.js:499:14)
at resolveExports (internal/modules/cjs/loader.js:548:12)
at Function.Module._findPath (internal/modules/cjs/loader.js:654:22)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:953:27)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Module.require (internal/modules/cjs/loader.js:1028:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\AlaaMohammed\PhpstormProjects\vue-2\node_modules\autoprefixer\lib\autoprefixer.js:5:17)
at Module._compile (internal/modules/cjs/loader.js:1139:30) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! vue-2@0.1.0 serve:
vue-cli-service serve npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the vue-2@0.1.0 serve script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.

I want some to response to my problem

asked Jul 6, 2020 at 15:24

Aladdin Mohammed's user avatar

1

try to reinstall the colerette plugin version 1.2.0 manually

npm i colorette@1.2.0

answered Jul 9, 2020 at 4:50

zeinFikry's user avatar

zeinFikryzeinFikry

2863 silver badges5 bronze badges

2

Upgrade node to version 14.5 will resolve this issue.

answered Jul 11, 2020 at 21:41

Yacine Bensouici's user avatar

0

I did the following and it worked:

1)_ First i checked the versions

  • npm outdated
  • npm update
  • npm install
  • npx npm-check-updates — u

2)_ Once i was 100% sure the problems didn’t come from that source, i typed the following:

npm install autoprefixer@9.8.0

and it solved the problem.

Note: try to «npm start» before you connect the scss to the App, just to see if you can visualize something (like: hello world) in the browser, if everything is fine, create the folder scss with the main.scss inside of it, import it and then try the steps.

answered Aug 20, 2020 at 16:36

TheDyslexicWebDev's user avatar

My node -v: v16.1.0
What worked for me npm ci

answered Sep 28, 2021 at 16:14

Stephen Ó Connor's user avatar

Updating the node version can solve your problem.

4b0's user avatar

4b0

22k30 gold badges95 silver badges142 bronze badges

answered Aug 27, 2020 at 15:25

Robert Almeida's user avatar

1

Ошибка:
> vuehello@0.1.0 serve
> vue-cli-service serve

INFO Starting development server…
10% building 2/4 modules 2 active C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\hot\dev-server.jsError: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:503:5
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:358:12
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at iterateNormalLoaders (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:236:3
at runSyncOrAsync (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:130:11)
at iterateNormalLoaders (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:232:2)
at Array. (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
node:internal/crypto/hash:67
this[kHandle] = new _Hash(algorithm, xofLen);
^

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at module.exports (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\util\createHash.js:135:53)
at NormalModule._initBuildHash (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:417:16)
at handleParseError (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:471:10)
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:503:5
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\webpack\lib\NormalModule.js:358:12
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:373:3
at iterateNormalLoaders (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
at Array. (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\loader-runner\lib\LoaderRunner.js:205:4)
at Storage.finished (C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:55:16)
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:91:9
at C:\Users\omara\OneDrive\Рабочий стол\vuejs\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
opensslErrorStack: [ ‘error:03000086:digital envelope routines::initialization error’ ],
library: ‘digital envelope routines’,
reason: ‘unsupported’,
code: ‘ERR_OSSL_EVP_UNSUPPORTED’
}

Node.js v17.1.0

Package.json:
{
«name»: «vuehello»,
«version»: «0.1.0»,
«private»: true,
«scripts»: {
«serve»: «vue-cli-service serve»,
«build»: «vue-cli-service build»
},
«dependencies»: {
«core-js»: «^3.6.5»,
«vue»: «^3.0.0»,
«vue-router»: «^4.0.0-0»,
«vuex»: «^4.0.0-0»
},
«devDependencies»: {
«@vue/cli-plugin-babel»: «~4.5.0»,
«@vue/cli-plugin-router»: «~4.5.0»,
«@vue/cli-plugin-vuex»: «~4.5.0»,
«@vue/cli-service»: «~4.5.0»,
«@vue/compiler-sfc»: «^3.0.0»
},
«browserslist»: [
«> 1%»,
«last 2 versions»,
«not dead»
]

I’ve got a problem while running


npm run serve

command after initializing new project with Vue Cli.
Error looks like this:

ERROR  Failed to compile with 1 error                                                                          08:42:28

error

Module not found: Error: Can't resolve '<project folder>\node_modules\webpack-dev-server\client\index.js?protocol=ws&hostname=192.168.18.103&port=8081&pathname=%2Fws&logging=none&progress=true&overlay=%7B%22errors%22%3Atrue%2C%22warnings%22%3Afalse%7D&reconnect=10&hot=true&live-reload=true' in '<project folder>'

ERROR in Module not found: Error: Can't resolve '<project folder>\node_modules\webpack-dev-server\client\index.js?protocol=ws&hostname=192.168.18.103&port=8081&pathname=%2Fws&logging=none&progress=true&overlay=%7B%22errors%22%3Atrue%2C%22warnings%22%3Afalse%7D&reconnect=10&hot=true&live-reload=true' in '<project folder>'

webpack compiled with 1 error

Also after running


npm install

after initialization i have an error:


npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @vue/eslint-config-standard@6.1.0
npm ERR! Found: eslint-plugin-vue@8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0
npm ERR! node_modules/@vue/eslint-config-standard
npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

Running the command with –force or –legacy-peer-deps doesn’t help at all.

I have:

  • npm version 9.5.1
  • nodeJS version 18.14.2
  • vue/cli version 5.0.8

I tried reinstalling webpack-dev-server extension, deleting and reinstalling node_modules folder and many more. No effect :/ Still the same error.

I’d like to finally run my Vue dev server and get to work.

Понравилась статья? Поделить с друзьями:
  • Nvrtc64 102 0 dll как убрать ошибку
  • Nvms 1000 ошибка входа
  • Npm install windows ошибка
  • Nvpciflt sys ошибка
  • Npm init y ошибка