node.js - 我在使用 npm install express 时遇到问题
问题描述
我正在学习使用 nodeJs 的 express 框架。我在使用安装 express 时遇到问题npm install express --save
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/37/92'
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/22/9a'
Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/akandegeorge/.npm/_cacache/index-v5/06/5a'
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/akandegeorge/.npm/_logs/2019-08-18T18_13_54_120Z-debug.log
解决方案
将用户的 npm 相关文件夹的所有权恢复到当前用户,如下所示:
sudo chown -R $USER:$GROUP ~/.npm
sudo chown -R $USER:$GROUP ~/.config
然后尝试
sudo npm install express --save
推荐阅读
- android - 生成签名的apk并在真实设备中安装时应用程序无法正常工作
- javascript - 在 Javascript 中,为什么附加到 TextArea 字段在一种情况下失败,而在另一种情况下则失败
- php - 前端 ACF 复选框在保存时未在管理员中更新
- r - 自定义 gtable(坐标和颜色)
- amazon-web-services - 为什么 DynamoDB LastEvaluatedKey 取决于查询的限制?
- windows - perl 命令创建 matrix.txt
- java - 如何在另一个mapper中复用MyBatis的mapper?
- hazelcast - 如何在 3.9.3 Eviction 中测试 hazelcast Eviction 不起作用
- django - 分配前引用的局部变量'' - 在视图中使用模型表单
- sql-server - 如果 SQL 中的不同列包含多行,如何识别人员或 ID