解决 npm install Error: EACCES: permission denied, mkdir node_modules/gifsicle/

1. 原因CentOS jenkins自动构建服务 使用root账号执行npn install 指令,报错如下

> [email protected] postinstall /***//node_modules/gifsicle
> node lib/install.js

  ⚠ EACCES: permission denied, open '/***//node_modules/gifsicle/vendor/gifsicle'
  ⚠ gifsicle pre-build test failed
  ℹ compiling from source
  ✖ Error: EACCES: permission denied, mkdir '/***//node_modules/gifsicle/9341d536-a2fb-4d27-b4de-c1cf6ba79f6b'

> [email protected] postinstall /***//node_modules/optipng-bin
> node lib/install.js

  ⚠ EACCES: permission denied, open '/***//node_modules/optipng-bin/vendor/optipng'
  ⚠ optipng pre-build test failed
  ℹ compiling from source
  ✖ Error: EACCES: permission denied, mkdir '/***//node_modules/optipng-bin/5ca0582d-e98e-415f-9043-9b1927de9804'

> [email protected] postinstall /***//node_modules/pngquant-bin
> node lib/install.js

  ⚠ EACCES: permission denied, open '/***//node_modules/pngquant-bin/vendor/pngquant'
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✖ Error: pngquant failed to build, make sure that libpng-dev is installed

2.  调整构建指令

npm install --unsafe-perm=true --allow-root

错误解决。

你可能感兴趣的:(centos,linux,js)