简体   繁体   English

使用npm安装画布失败

[英]Install canvas fails using npm

I'm using macOS Mojave, Xcode 10.1. 我正在使用macOS Mojave,Xcode 10.1。 I'm struggling when running npm install canvas. 我在运行npm install canvas时很挣扎。 node-gyp is 3.8.0 of mine. node-gyp是我的3.8.0。

npm WARN package.json babylon@5.5.29 No repository field.
npm WARN package.json babylon@5.5.29 No README data
npm WARN package.json babylon@5.5.29 No license field.
-
> canvas@1.3.12 install /Users/chuoi/project/node_modules/canvas
> node-gyp rebuild

  SOLINK_MODULE(target) Release/canvas-postbuild.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/canvas-postbuild.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/chuoi/.nvm/versions/node/v4.3.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/node" "/Users/chuoi/.nvm/versions/node/v4.3.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/chuoi/project/node_modules/canvas
gyp ERR! node -v v4.3.1
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Darwin 18.2.0
npm ERR! argv "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/node" "/Users/chuoi/.nvm/versions/node/v4.3.1/bin/npm" "install" "canvas"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! canvas@1.3.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the canvas@1.3.12 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the canvas package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls canvas
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/chuoi/project/middleware/npm-debug.log 

Could you help me on this cause it takes a whole day and I have no idea how to fix it. 您能帮我解决这个问题吗,因为它需要一整天,我不知道如何解决。

You need to update your node version. 您需要更新您的节点版本。 Canvas doesn't support node 4.x. Canvas不支持节点4.x。

"The minimum version of Node.js required is 6.0.0." “所需的最低Node.js版本为6.0.0。”

https://www.npmjs.com/package/canvas https://www.npmjs.com/package/canvas

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM