Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

osx can't install webpack due to missing dependency

Tags:

npm

macos

webpack

Is nobody else getting this?

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "/Users/aaa/Documents/projects/sweetalert/node_modules/canvas-prebuilt/canvas/build/Release/canvas-prebuilt.node" (not found)
node-pre-gyp http GET https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.11/canvas-prebuilt-v1.6.11-node-v67-darwin-x64.tar.gz
node-pre-gyp http 404 https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.11/canvas-prebuilt-v1.6.11-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: 404 status code downloading tarball https://github.com/chearon/node-canvas-prebuilt/releases/download/v1.6.11/canvas-prebuilt-v1.6.11-node-v67-darwin-x64.tar.gz
node-pre-gyp ERR! stack     at Request.<anonymous> (/Users/aaa/Documents/projects/sweetalert/node_modules/canvas-prebuilt/node_modules/node-pre-gyp/lib/install.js:137:27)
node-pre-gyp ERR! stack     at Request.emit (events.js:198:15)
node-pre-gyp ERR! stack     at Request.onRequestResponse (/Users/aaa/Documents/projects/sweetalert/node_modules/request/request.js:1066:10)
node-pre-gyp ERR! stack     at ClientRequest.emit (events.js:193:13)
node-pre-gyp ERR! stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:560:23)
node-pre-gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:113:17)
node-pre-gyp ERR! stack     at TLSSocket.socketOnData (_http_client.js:447:22)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:193:13)
node-pre-gyp ERR! stack     at addChunk (_stream_readable.js:295:12)
node-pre-gyp ERR! stack     at readableAddChunk (_stream_readable.js:276:11)
node-pre-gyp ERR! System Darwin 18.0.0

I can't install webpack because of fsevents installation failing because of the missing node-canvas-prebuilt.

What can I do?

like image 687
Harry Avatar asked Nov 07 '22 17:11

Harry


1 Answers

The installation via Homebrew seems outdated as it tries to install version 1.6.11 of canvas-prebuilt, which was released around 2017 and is not anymore available. The closest version to it is 1.6.15.

I would recommend you follow the installation instructions from the official documentation to install it via npm on a per-project basis:

npm install --save-dev webpack
npm install --save-dev webpack-cli
# or for a one-liner just do npm i webpack webpack-cli

Note it is not recommended to install WebPack globally (npm i -g webpack) but to install it for each of your projects so different versions of the tool can be used in parallel. This will make your life easier in the future when using WebPack with projects from various development times.

like image 73
Siavas Avatar answered Nov 14 '22 23:11

Siavas