3.1.3
Node 11.1.0 / yarn 1.12.3 / Arch Linux
> vue create test
ERROR Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions'
Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions'
vue should not write to global files
vue tries to write to global file '/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions' and fails if it does not have permission to do so
This can be fixed by just running sudo vue create test
but why it root required to create a new package?
Sorry for the inconvenience 🙁
This file is used to cache the latest version map. Didn't expect a permission issue when adding this feature… We'll refine the version check mechanism in the next release.
We could put it in some temporary files for vue but then that does not persists across reboot. If we would like it to persists, maybe can make use of XDG_DATA_HOME
or XDG_CACHE_HOME
for linux to avoid permission issues and keep the map across reboot. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Creating test project as root only partially soves the problem. Here is the output when running vue create as a regular user:
Vue CLI v3.1.3
? Please pick a preset: (Use arrow keys)
❯ default (babel, eslint)
Manually select features (node:6690) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/usr/lib/node_modules/@vue/cli/lib/util/.versions'
(node:6690) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:6690) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@vue/cli is installed via npm install -g. The same error if installed using yarn global add.
That's true. But I solve that with sudo -i
and then npm install -g
.
Nevertheless the program being launched by an ordinary user tries to write into the file in the global directory, which in the world of Linux is utterly forbidden.
I have same trouble but i remember about
vue ui
..and i got new project without root privelegies :)
same problem !
do what to fix this absolutely
Thx
The workaround is something like this:
Edit your ~/.bashrc
or ~/.zshrc
, add the following
export NPM_PACKAGES=$HOME/.npm
export MANPATH=$NPM_PACKAGES/share/man:$(manpath)
export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
export PATH=$NPM_PACKAGES/bin:$HOME/bin:$PATH
Then
$ source .bashrc
or
$ source .zshrc
After this npm will install globally into your home folder and the permission problem disappears... Sort of.
But another problem arises. Some programs installed into ~/.npm
fail to find their dependencies that are previosly installed genuinely globally by root (or sudo) and require you to install them under your ~/.npm
directory. For example if you install webpack-cli as root under /usr
and webpack as unprivileged user under ~/.npm
, webpack
command will complain that it can't find webpack-cli.
Another workaround can be to add extended permissions using chacl
for the unprivileged user that you develop under on the file /usr/lib/node_modules/@vue/cli/lib/util/.versions
.
I've tested the last few versions on linux (Centos): Version 3.1.1 seems to be the last that works out of the box. It may be easier just to use that
@clrgit downgrading to 3.1.1 worked on Arch as well. Thanks for the tip.
I have same trouble but i remember about
vue ui
..and i got new project without root privelegies :)
not by me :
vue ui
🚀 Starting GUI...
(node:14216) UnhandledPromiseRejectionWarning: Error: EACCES: permission denied, open '/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions'
(node:14216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14216) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
🌠 Ready on http://localhost:8000
{ [Error: EACCES: permission denied, open /usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions']
errno: -13,
code: 'EACCES',
syscall: 'open',
path:
'/usr/local/share/.config/yarn/global/node_modules/@vue/cli/lib/util/.versions' }
Most helpful comment
Sorry for the inconvenience 🙁
This file is used to cache the latest version map. Didn't expect a permission issue when adding this feature… We'll refine the version check mechanism in the next release.