Mac notebook M1 chip installs Hashlips library npm error problem
Foreword
When generating NFT, we often prepare all the materials needed for NFT, and then stack each material on the same canvas to generate an NFT, but if we manually It’s too troublesome to stack one by one, because NFTs are often issued in thousands of ten thousand, so manual generation is unrealistic, So what can we do to generate It, Is to use the computer, There are many similar tools on the Internet, There are graphical and pure code, And many use Paython to generate NFT, But there is a node abroad The script tool Hashlips
can directly use node to generate, and it is very convenient and powerful to use, There was no problem when using the windows system before, After changing the MBP later, I found that Hashlips
reported an error when executing npm install
Cause Analysis
After various searches and research, I found that Hashlip
is implemented with canvas canvas, Then I touched the node-canvas
library, There is a very similar problem in the issue of this library, which probably means that the Mac with m1 chip cannot directly use npm to install the library to node-canvas
, You need to use Homebrew
to install what you need.
Solution
Official solution
In fact, both node-canvas
and hasllips
have released solutions one after another,The solution is actually the same,The following is hasllips
The method approved in the official issue
The correct method is as follows:
1. Download and install Node.js "Current" version, as opposed to the "LTS" (Long Term Support) version. This is now v18.0.0 as of the time of this post , but 17.x will work as well:
2. Ensure you have homebrew installed. You can go to or just use this command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install .sh)" to install Homebrew.
3. Install the dependencies via Homebrew using this command: arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg
4. In your root folder for the art engine project, install the project: npm install
The correct way is as follows:
1. Download and install the latest version of Node.js , instead of the "LTS" (Long Term Support) version.
2. Install Homebrew.
3. Install dependencies via Homebrew using the following command :arch -arm64 brew install pkg-config cairo pango jpeg giflib librsvg
4. In the root folder of your art engine project ,install the project:npm install
My solution
Combined with the above solution, The landlord did not upgrade the node version to the latest version, but used the LTS long-term support version of Node16.6
, then Directly use Homebrew
to execute the command brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman
install
Wait for the above installation to complete,npm install
or yarn install
directly in the project
Read More:
- M1 MacBook pod install Report an error chip incompatibility problem
- [Solved] Mac M1 Brew install Error: Command failed with exit 128:git
- Mac M1 Start Virtual Machine Centos8 with PD to install Kafka error: Error: VM option ‘UseG1GC‘
- [Solved] Executing npm install error: npm ERR! code EINTEGRITY
- NPM install error: Cannot find module ‘D:\zip\node_modules\npm\bin\npm-cli.js‘
- NPM Install Error: npm ERR! ERESOLVE unable to resolve dependency tree
- npm install npm ERR code ERESOLVE [How to Solve]
- Puppeteer Error: Chromium revision is not downloaded. Run “npm install“ or “yarn install“
- Yarn install error: 00h00m00s 0/0: : ERROR: [Errno 2] No such file or directory: ‘install‘
- Vue-element-admin Use npm install Error: npm ERR! Error while executing:
- [Solved] Mac M1 Debug Error: could not launch process: can not run under Rosetta
- Vue Error: command failed: npm install –loglevel error –registry=https://registry.npm.taobao.org
- M1 MacBook cannot use pip to install pandas [How to Solve]
- Analysis of npm error ENOTFOUND npm ERR! network request to https://npm.***.com/*** failed and the role of the .npmrc file
- How to Solve Error: Error running ‘__rvm_make -j8‘ (Mac M1 BigSur)
- MAC install lightgbm and xgboost Error [How to Solve]
- [Solved] This usually happens because your environment has changed since running `npm install`
- MAC uses homebrew to install wget error [How to Solve]
- [Solved] npm install sass@~1.32 sass-loader deepmerge -D Install Error
- [Solved] Mac Install homebrew Error: error: Not a valid ref: refs/remotes/origin/master