npm node-gyp rebuild - Error: `gyp` failed with exit code: 1

阅读更多

报错内容可能不一样:

gyp: Call to './util/has_lib.sh freetype' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/home/xxx/.nvm/versions/node/v7.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:308:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.13.0-45-generic
gyp ERR! command "/home/xxx/.nvm/versions/node/v7.8.0/bin/node" "/home/xxx/.nvm/versions/node/v7.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/xxx/Dev/vue/node_modules/canvas
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.5.0

 

解决方案:

~$ rm -rf ~/.node-gyp/

~$ npm i -g node-gyp

~$ rm -rf 项目/node_modules

~$ npm i -d

 

 

refs:

https://github.com/nodejs/node-gyp/issues/809

 

https://github.com/Automattic/node-canvas/wiki/Installation%3A-Ubuntu-and-other-Debian-based-systems

$ sudo apt update 
$ sudo apt install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev 

你可能感兴趣的:(学习永无止境,每天进步一点点,npm,node,乔乐共享)