admin管理员组文章数量:1433896
when i try to install ex:
npm install -g n
I got a error:
npm error code EACCES
npm error syscall rename
npm error path /usr/local/lib/node_modules/n
npm error dest /usr/local/lib/node_modules/.n-oBR4I52F
npm error errno -13
npm error Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/n' -> '/usr/local/lib/node_modules/.n-oBR4I52F'
npm error at async Object.rename (node:internal/fs/promises:782:10)
npm error at async moveFile (/usr/lib64/node_modules/npm20/node_modules/@npmcli/fs/lib/move-file.js:30:5)
npm error at async Promise.allSettled (index 0)
npm error at async [reifyPackages] (/usr/lib64/node_modules/npm20/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
npm error at async Arborist.reify (/usr/lib64/node_modules/npm20/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
npm error at async Install.exec (/usr/lib64/node_modules/npm20/lib/commands/install.js:150:5)
npm error at async module.exports (/usr/lib64/node_modules/npm20/lib/cli/entry.js:74:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'rename',
npm error path: '/usr/local/lib/node_modules/n',
npm error dest: '/usr/local/lib/node_modules/.n-oBR4I52F'
npm error }
npm error
i try to install with sudo, but do not work. my company is blocking the installation.
when i try to install ex:
npm install -g n
I got a error:
npm error code EACCES
npm error syscall rename
npm error path /usr/local/lib/node_modules/n
npm error dest /usr/local/lib/node_modules/.n-oBR4I52F
npm error errno -13
npm error Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/n' -> '/usr/local/lib/node_modules/.n-oBR4I52F'
npm error at async Object.rename (node:internal/fs/promises:782:10)
npm error at async moveFile (/usr/lib64/node_modules/npm20/node_modules/@npmcli/fs/lib/move-file.js:30:5)
npm error at async Promise.allSettled (index 0)
npm error at async [reifyPackages] (/usr/lib64/node_modules/npm20/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
npm error at async Arborist.reify (/usr/lib64/node_modules/npm20/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
npm error at async Install.exec (/usr/lib64/node_modules/npm20/lib/commands/install.js:150:5)
npm error at async module.exports (/usr/lib64/node_modules/npm20/lib/cli/entry.js:74:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'rename',
npm error path: '/usr/local/lib/node_modules/n',
npm error dest: '/usr/local/lib/node_modules/.n-oBR4I52F'
npm error }
npm error
i try to install with sudo, but do not work. my company is blocking the installation.
Share Improve this question edited Nov 19, 2024 at 3:33 ewokx 2,4353 gold badges18 silver badges43 bronze badges asked Nov 19, 2024 at 3:27 Helder GonzagaHelder Gonzaga 114 bronze badges1 Answer
Reset to default 0Based on your log errors, i can see that is EACCES permissions errors
As the npm package documentation suggest, try to manually npm default directory, you can follow the steps mentioned in this document:
Note: Below links works in Mac and Linux based OS, not for Windows.
- Manually change npm's default directory
- Resolving EACCES permissions errors
So even if you do not get your issue resolved after changing directory manually, taking a look at these source should help you out:
- Error: EACCES, permission denied even after using sudo?
- Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
Hope these will help you fix installing the packages globally.
本文标签:
版权声明:本文标题:node.js - Whenever I try to install global npm packages, I get permission denied. How can I solve this. How can I install withou 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745584150a2664792.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论