Brew install node 145/28/2023 I wanted to use the Node.js canvas NPM package but running npm install canvas failed with messages like this: npm ERR! code 1 npm ERR! path /Users/flaviocopes/dev/old/generate-images-posts/node_modules/canvas npm ERR! command failed npm ERR! command sh -c node-pre-gyp install -fallback-to-build npm ERR! Failed to execute '/opt/homebrew/Cellar/ /16.14.2/bin/node /opt/homebrew/Cellar/ /16.14.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure -fallback-to-build -module=/Users/flaviocopes/dev/old/generate-images-posts/node_modules/canvas/build/Release/canvas.node -module_name=canvas -module_path=/Users/flaviocopes/dev/old/generate-images-posts/node_modules/canvas/build/Release -napi_version=8 -node_abi_napi=napi -napi_build_version=0 -node_napi_label=node-v93' (1) npm ERR! node-pre-gyp info it worked if it ends with ok npm ERR! node-pre-gyp info using npm ERR! node-pre-gyp info using | darwin | arm64 npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download npm ERR! node-pre-gyp info check checked for "/Users/flaviocopes/dev/old/generate-images-posts/node_modules/canvas/build/Release/canvas. However, it probably wont be the latest version of pnpm. Install node and yarn After you have installed Homebrew, install node (which includes npm) normally running brew install node Install Yarn using brew install yarn. brew install node14 Also remember that you can install more than 1 node package at the same time, but you cannot have them available at the same time. How to fix a node-pre-gyp install issue installing the Node.js canvas library on macOS If you installed Node.js using Homebrew, youll need to install corepack separately: brew install corepack This will automatically install pnpm on your system. To install the current version of Node.js and npm via Homebrew, open a Terminal window on your Mac and enter this command: brew install node However, I highly recommend you install specific major versions of Node.js as a matter of practice, because it forces you to be aware of exactly what version you're installing. Link it to the installed version (Note: Sometimes, when you try linking it or even while installing you might be asked to update your bash rc. Installation Steps: Open Terminal using Spotlight search by pressing
0 Comments
Leave a Reply. |