问题原因:使用最新的包报错

问题解决:改为稳定版本

vue-element-admin npm install 报错问题_desktop

npm ERR! code 1
npm ERR! path /Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.9.1 | darwin | x64
npm ERR! gyp http GET https://nodejs.org/download/release/v16.9.1/node-v16.9.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.9.1/node-v16.9.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.9.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.9.1/SHASUMS256.txt
npm ERR! (node:10356) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/ylmac/.node-gyp/16.9.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/ylmac/.node-gyp/16.9.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/ylmac/.node-gyp/16.9.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/canvas',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/ylmac/Desktop/vue-element-admin-master/vue-element-admin-master/node_modules/canvas
npm ERR! gyp ERR! node -v v16.9.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ylmac/.npm/_logs/2021-09-24T06_29_11_254Z-debug.log
➜ vue-element-admin-master npm i
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/nhn/raphael.git
npm ERR! git@github.com: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR!