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

> gifsicle@4.0.1 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'

> optipng-bin@6.0.0 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'

> pngquant-bin@5.0.2 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

错误解决。

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐