N
N
Nikita Kinash2021-07-02 18:35:15
Node.js
Nikita Kinash, 2021-07-02 18:35:15

Why does npm install packages in the wrong place and throw an error?

Today I decided to roll vue cli, before that I did without it
. As a result, I reinstalled node js.
And now, when trying to install something (yarn, vue-cli), it gives an interesting error:

{
npm ERR!     errno: -4048,
npm ERR!     code: 'EPERM',
npm ERR!     syscall: 'mkdir',
npm ERR!     path: 'C:\\users\\your_user\\AppData\\Roaming\\npm\\node_modules\\.staging'
npm ERR!   },
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: 'C:\\users\\your_user\\AppData\\Roaming\\npm\\node_modules\\.staging'
npm ERR! }

60df3218957d0351957205.png
And yes, if I run as admin, it creates a folder c:/users/your_user/...
Exactly your_user, not my username))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita Kinash, 2021-07-05
@nkinash

They sent a solution to those who are interested:
npm get prefix
outputs:

C:\users\your_user\AppData\Roaming\npm

Helped accordingly:
npm config set prefix="C:\Users\nka20\AppData\Roaming\npm"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question