简体   繁体   English

安装 dojo/cli 时缺少写入权限(试图避免 sudo)

[英]Missing write access when installing dojo/cli (trying to avoid sudo)

I'm following the "Get Going Quickly" from dojo.io and I've entered我正在关注 dojo.io 的“Get Going Quickly”并且我已经进入

npm i @dojo/cli @dojo/cli-create-app -g

but it fails with但它失败了

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules'
npm ERR! }

How can avoid this without using sudo ?如何在不使用sudo情况下避免这种情况? I've heard I should never use sudo with npm .我听说我永远不应该将sudonpm一起npm Is it correct?这是正确的吗? Should I really avoid it also in this case?在这种情况下,我真的应该避免它吗? I'm on Fedora version 32 and我在Fedora 32

npm -v
6.14.4

I've also tried to issue only我也试过只发布

npm i @dojo/cli -g

according to the Readme of dojo/cli but the error is the same.根据dojo/cli的自述文件,但错误是相同的。

只需将您的当前用户设置为该节点模块文件夹的所有者,如下所示($USER 指的是您当前的用户名)

sudo chown -R $USER /usr/local/lib/node_modules

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行sudo npm install -g @ vue / cli时发生无法预料的错误 - Unforseen errors when running sudo npm install -g @vue/cli 尝试打开iframe写入内容时出现周期性的“访问被拒绝” - Periodic “access is denied” when trying to open an iframe to write content 使用dojo keypress事件时无法避免最后输入的字符 - Not able to avoid the last character input when using the dojo keypress event 尝试在 Chrome 中加载仪表板页面时避免使用 document.write() - Avoid using document.write() occurs when trying to load a dashboard page in Chrome 在dojo中避免内存泄漏? - Avoid memory leaks in dojo? 尝试扩展dojo小部件“ dojox / timing”时未捕获到TypeError - Uncaught TypeError when trying to extend dojo widget “dojox/timing” 尝试在 CLI 中创建迁移时出现 TypeORM 错误 - TypeORM error when trying to create migration in CLI 输入回调范围后,可以访问闭包dojo对象 - Get access to closure dojo object when callback scope was entered 即使不尝试访问数据,Firestore 应用程序也会丢失或权限不足 - Firestore app gets missing or insufficient permissions even when not trying to access the data 尝试在 windows CLI 上启动 gulp 时出错 - Error when trying to initiate gulp on windows CLI
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM