0

I am new to Vue. and searched everywhere for the correct answer. But no luck. Please Help me on this.

I can't create a new vue project. at the first I ran npm install -g @vue/cli

and after that vue create vue-animated-ui

But it gives an error,

C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\@vue\cli\node_modules\execa\index.js:347
                throw err;
                ^

Error: Command failed: npm --version
'npm' is not recognized as an internal or external command,
operable program or batch file.


    at makeError (C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\@vue\cli\node_modules\execa\index.js:174:9)
    at Function.module.exports.sync (C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\@vue\cli\node_modules\execa\index.js:338:15)
    at new PackageManager (C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\@vue\cli\lib\util\ProjectPackageManager.js:126:42)
    at Object.<anonymous> (C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\@vue\cli\lib\util\getVersions.js:6:12)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)

npm version 6.14.6 and vue cli version @vue/cli 4.5.13

Thank you in advance.

Rishni Meemeduma
  • 324
  • 3
  • 14
  • 1
    npm is clearly not in your Windows `PATH` variable. See [the accepted answer here](https://stackoverflow.com/questions/27864040/fixing-npm-path-in-windows-8-and-10) for how to solve it. Then retry in a new terminal window (=with the reloaded environment) – webketje Sep 08 '21 at 07:56
  • 1
    @Tyblitz thank you so much. After i add path to Environment variable.it worked. – Rishni Meemeduma Sep 08 '21 at 08:12

1 Answers1

0

Ah! base the file path looks like you are using NVM control the node version.

  • So I think this issue is not vue/cli issue. it's an nvm issue.
  • And base on the error message it's npm v can not execute.
  • I suggest you first check in this path C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\
  • Do you have the npm folder like this: enter image description here

  • If not it means when you use nvm use 10.22.0 it does not install the npm.

  • So you can install manually

    • this is the node npm version: nodejs.org
    • node v10.22.0 should use npm v6.14.6
    • go to npm download the 6.14.6 version.
    • unzip it to your path C:\Users\User\AppData\Roaming\nvm\v10.22.0\node_modules\ and rename it to npm
  • then try npm -v if you got version. means it's work. it'll also work for vue/cli

scott
  • 71
  • 1
  • 3