Странно, но я почему-то не могу установить vue-cli. Терминал выдает ошибку
PS C:UsersSkwoDesktopvue.new.project> npm i @vue/cli
Нераспознанный токен в исходном тексте.
строка:1 знак:7
+ npm i <<<< @vue/cli
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
PS C:UsersSkwoDesktopvue.new.project> npm install -g @vue/cli
Нераспознанный токен в исходном тексте.
строка:1 знак:16
+ npm install -g <<<< @vue/cli
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnrecognizedToken
Такие ответы на разные попытки.
Проверил установлены ли глобально пакеты, может нужно переустановить.
Никаких пакетов Vue не обнаружил..
This document covers some common Vue CLI issues and how to resolve them. You should always follow these steps before opening a new issue.
Running installation with sudo
or as root
If you install @vue/cli-service
as root
user or with sudo
, there might be issues when running package postinstall
scripts.
This is a security feature of npm. You should always avoid running npm with root privileges because install scripts can be unintentionally malicious.
If you must however, you can workaround this error by setting the --unsafe-perm
flag of npm. This can be done by prefixing the command with an environment variable, i.e.
npm_config_unsafe_perm=true vue create my-project
Symbolic Links in node_modules
If there’re dependencies installed by npm link
or yarn link
, ESLint (and sometimes Babel as well) may not work properly for those symlinked dependencies. It is because webpack resolves symlinks to their real locations by default, thus breaks ESLint / Babel config lookup.
A workaround for this issue is to manually disable symlinks resolution in webpack:
// vue.config.js
module.exports = {
chainWebpack: (config) => {
config.resolve.symlinks(false)
}
}
WARNING
Disabling resolve.symlinks
may break hot module reloading if your dependencies are installed by third-party npm clients that utilized symbolic links, such ascnpm
or pnpm
.
I’m trying to install Vue-cli environemnt via NPM.
npm install --global vue-cli
After that I want to create project
vue init webpack my-project
And I get an error
'vue' is not recognized as an internal or external command,
operable program or batch file.
I’ve read some solutions, most of them concern changing
PATH to C:Users{YourUser}AppDataRoamingnpm
Didn’t work for me. Can anyone help.
asked May 15, 2017 at 16:25
6
I follow these commands, It’s work fine for me.
npm install -g vue-cli
npm install -g vue
Edit the System environment variables, and enter the following path, and if still having a problem just try to add a path in System User Variables
C:Program Filesnodejsnode.exe;
C:Users{UserName}AppDataRoamingnpm
Check vue installed in C:Users{UserName}AppDataRoamingnpm
answered Oct 16, 2019 at 7:41
sarath kumarsarath kumar
1,26510 silver badges6 bronze badges
1
yarn add @vue/cli-service
or
npm install @vue/cli-service
is what worked for me
AS Mackay
2,8319 gold badges19 silver badges25 bronze badges
answered Jul 27, 2019 at 6:29
Well, problem was solved by simply deleting everything related to vue-cli installed before. And re-installing vue-cli.
answered May 25, 2017 at 19:25
ogostosogostos
1,4252 gold badges19 silver badges29 bronze badges
1
I have faced simillar issue and re-installing vue-cli didn’t work for me. Strange thing is vue and vue-cli get installed successfully but once I tried to create project by using below command
vue init webpack myfirstproject
I get below error:
'vue' is not recognized as an internal or external command,operable program or batch file.
Tried various solutions but nothing worked for me. Please find my NPM and Node details below:
NPM version: 6.2.0
Node version: 8.7.0
Actually the issue was «vue-cli» is not supporting to my Node(8.7.0). It requires Node >=8.9. Once I upgraded my Node version. everything is working fine.
upgrading your Node version is the correct way to deal with this issue
answered Jul 24, 2018 at 14:11
Sandy…..Sandy…..
2,7832 gold badges15 silver badges26 bronze badges
I found this same issue with another possible problem. I had
create-react-app@1.5.2 installed globally
npm list -g —depth=0 will display your globals
I simply uninstalled create-react-app
npm uninstall create-react-app
Vue vue-cli-service now works as expected.
answered Jun 1, 2019 at 13:17
had the same issue, i deleted my node_modules and re-install and it worked
answered Aug 21, 2019 at 11:53
KokoKoko
311 silver badge5 bronze badges
I had the same problem after searching a lot I found this solution:
You need to Add C:Program Filesnodejs to your PATH environment variable. To do this follow these steps:
- Use the global Search to go to «Environment Variables»
- Click «Edit system environment variables»
- Click «Environment Variables» in the dialog
- In the «System Variables» box, search for Path and edit it to include C:Program Filesnodejs.
You will have to restart any currently-opened command prompts before it will take effect.
I hope it works, good luck!
answered Sep 4, 2019 at 9:33
DiegoDiego
112 bronze badges
I was installing @vue/cli
using yarn, i.e. I ran
yarn global add @vue/cli
Calling vue
on windows did not work after the installation (‘vue’ is not recognized as an internal or external command)
What I needed to do was to add C:Users<MY USERNAME>AppDataLocalYarnbin
to path.
answered Dec 27, 2020 at 16:52
David VonkaDavid Vonka
5114 silver badges14 bronze badges
yarn global add @vue/cli
did not work for me
So I removed using yarn global remove @vue/cli
Then I installed using npm install -g @vue/cli
and its working fine.
answered Mar 23, 2021 at 3:24
AlokAlok
7,2847 gold badges53 silver badges92 bronze badges
1)Try to remove all the node files, npm and nvm files/folders.
2)Also, remove the PATH of node js and nvm from environment variables.
3)try commands:
node -v
npm -v
nvm -v
above commands only to make sure that all the entities related to node are uninstalled.
4) install node, and if necessary install nvm(optioal), then run command
npm install -g @vue/cli
above procedure proven to be useful for me. Just give it a try!
answered Jan 14, 2020 at 4:51
AryeshAryesh
3662 silver badges16 bronze badges
for Yarn -> need to install it:
npm install -g yarn
Installing Vue CLI Package:
yarn global add @vue/cli
To create project:
vue create project-name
To run:
yarn serve
Uninstalling:
yarn global remove @vue/cli
I follow «npm» package manager instead of «yarn» package manager console because yarn give me a problem while installing it;
command to install Vue CLI:
npm install -g @vue/cli
For to create Vue project:
vue create "project-name"
For to run Vue project:
npm run serve
Phil Dukhov
62.7k13 gold badges161 silver badges195 bronze badges
answered Feb 19, 2022 at 6:54
Когда я ввожу команду vue, то оно пишет, что такой команды нет. При этом когда я просматриваю пакеты, которые у меня установлены, то cli там есть) В итоге у меня не получилось с ним ничего, и я установил vue через команду «npm init vue@latest». Я так понял, что это что-то немного другое, но всё получилось, и приложение запускается на 3000 сервере
Добавлено через 2 минуты
Когда я ввожу команду vue, то оно пишет, что такой команды нет, точнее вот это пишет:
Код
PS C:Usersadminmyproject> vue --version vue : Не удается загрузить файл C:UsersadminAppDataRoamingnpmvue.ps1. Файл C:UsersadminAppDataRoamingnpmvue.ps1 не имеет цифровой подписи. Невозможно выполнить сценарий в указанной системе. Для получения дополнительных сведений о выполнении сценариев и н астройке политики выполнения см. about_Execution_Policies по адресу https:/go.microsoft.com/fwlink/?LinkID=135170. строка:1 знак:1 + vue --version + ~~~ + CategoryInfo : Ошибка безопасности: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess PS C:Usersadminmyproject>
И при этом, когда я просматриваю пакеты, которые у меня установлены, то cli там есть) В итоге у меня не получилось с ним ничего, и я установил vue через команду «npm init vue@latest». Я так понял, что это что-то немного другое, но всё получилось, и приложение запускается на 3000 сервере
Hey so I’m trying to install Vue via npm (sudo npm install -g @vue/cli
) and I just get a bunch of warnings and errors and I can’t really make sense of it and have no idea why its happening…
npm WARN deprecated request@2.88.2: request has been deprecated, see [`https://github.com/request/request/issues/3142`](https://github.com/request/request/issues/3142) npm WARN deprecated resolve-url@0.2.1: [`https://github.com/lydell/resolve-url#deprecated`](https://github.com/lydell/resolve-url#deprecated) npm WARN deprecated urix@0.1.0: Please see [`https://github.com/lydell/urix#deprecated`](https://github.com/lydell/urix#deprecated) npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2. /usr/local/bin/vue -> /usr/local/lib/node_modules/@vue/cli/bin/vue.js > fsevents@1.2.13 install /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents` > node install.js gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/Users/jamesecroyd/Library/Caches/node-gyp/12.18.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp" gyp WARN install got an error, rolling back install gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@vue/cli/node_modules/fsevents/.node-gyp' gyp ERR! System Darwin 18.7.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/local/lib/node_modules/@vue/cli/node_modules/fsevents gyp ERR! node -v v12.18.0 gyp ERR! node-gyp -v v5.1.0 gyp ERR! not ok
Anyone have any idea why this is happening?
I have installed and uninstalled Vue multiple times, no luck…
RobC
22.4k20 gold badges72 silver badges80 bronze badges
asked Jun 21, 2020 at 5:58
Use NPM’s --unsafe-perm
flag:
sudo npm install -g @vue/cli --unsafe-perm
Or switch to a Node version manager (e.g., nvm
or n
), which avoids these issues.
answered Jun 21, 2020 at 6:10
tony19tony19
122k18 gold badges219 silver badges294 bronze badges
Fixed my Mac install this way:
- Uninstalled vue cli first.
sudo npm uninstall -g @vue/cli
- Re-installed with added switch to deal with file access issue. Which gives some warnings, but no errors.
sudo npm install -g @vue/cli --unsafe-perm
- Also then, installed the dependency in the warning that printed out at the very end of the install in Step 2.
sudo npm install -g vue@3.0.0-rc.9
After step 3, a «vue —version» command prints «@vue/cli 4.5.4» at this point, but it would do that previously.
So for a real test, I created a new project in the vue ui, which took much longer (30+ seconds) than my original first project created after the original troubled vue cli install.
And that new project works! — I clicked «serve» in the Tasks window, can see a clean build in the Output window, and the demo page loads at http://localhost:8080/
like it supposed to! Welcome to Your Vue.js App, etc…
answered Aug 27, 2020 at 18:19
warrenswarrens
1,50116 silver badges16 bronze badges
i had the same problem
just run this command
sudo npm uninstall -g @vue/cli
first check you have installed npm and node
answered Jul 26, 2021 at 10:55