node.js - sh : 1: node: Permission denied

标签 node.js npm

尝试在 ubuntu 18.04 上运行此命令

npm install -g pngquant-bin

但我得到了这个错误,

[..................] | fetchMetadata: sill resolveWithNewModule npm-conf@1.1.3 checking installable status
npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
/root/.nvm/versions/node/v10.8.0/bin/pngquant -> /root/.nvm/versions/node/v10.8.0/lib/node_modules/pngquant-bin/cli.js

> pngquant-bin@5.0.0 postinstall /root/.nvm/versions/node/v10.8.0/lib/node_modules/pngquant-bin
> node lib/install.js

sh: 1: node: Permission denied
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! pngquant-bin@5.0.0 postinstall: `node lib/install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the pngquant-bin@5.0.0 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/2018-08-12T18_08_02_197Z-debug.log

你知道如何处理这个问题吗? 我尝试了此 articles 中找到的所有解决方案还没有成功。

最佳答案

遇到同样的错误sh: 1: node: Permission denied

所以这对我有用

npm config set user 0
npm config set unsafe-perm true

关于node.js - sh : 1: node: Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51811564/

相关文章:

node.js - Homebridge 定制配件创建

node.js - 使用批处理文件时, 'grunt'不被识别为内部或外部命令、可运行程序或批处理文件

javascript - 使用异步中断 Node 脚本

javascript - 滚动到 Vue 中模式窗口的底部

javascript - Uncaught ReferenceError : PythonShell is not defined - PythonShell for Nodejs and Electron

javascript - 用于简化javascript中表达式的递归函数

javascript - 错误 : ER_PARSE_ERROR: You have an error in your SQL syntax;

npm - YARN 或 NPM 软件包安装缺少 src 文件夹

node.js - Npm 无法进行身份验证,您的身份验证 token 似乎无效

react-native - Expo 中的 React Native 对等依赖问题