报错信息
sh: 1: node: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! @apollo/protobufjs@1.2.7 postinstall: `node scripts/postinstall`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @apollo/protobufjs@1.2.7 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-03-31T05_37_32_610Z-debug.log
解决方法
这个错误通常是由于权限不足引起的。您可以尝试以下解决方法:
- 确保您使用的是 root 用户。如果不是,请使用以下命令切换到 root 用户:
sudo su
- 确保您的 npm 版本是最新的。您可以运行以下命令来更新 npm:
npm install -g npm
- 尝试使用管理员权限重新安装 @apollo/protobufjs。您可以运行以下命令(如果是 root 的不用 sudo):
sudo npm install -g @apollo/protobufjs