question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

trying to run yarn install

See original GitHub issue

so about every tutorial i’ve followed, this problem has occurred. either it be from cd > js or the just like the tutorial said, from

cd metaplex/js/packages/cli

I run yarn install and this pops up,

error /Users/sc/solana-mint/metaplex/js/node_modules/canvas: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments: Directory: /Users/sc/solana-mint/metaplex/js/node_modules/canvas Output: node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@1.0.7 node-pre-gyp info using node@16.13.1 | darwin | arm64 node-pre-gyp info check checked for “/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/Release/canvas.node” (not found) node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-darwin-unknown-arm64.tar.gz node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-darwin-unknown-arm64.tar.gz node-pre-gyp WARN Pre-built binaries not installable for canvas@2.8.0 and node@16.13.1 (node-v93 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-darwin-unknown-arm64.tar.gz gyp info it worked if it ends with ok gyp info using node-gyp@5.1.1 gyp info using node@16.13.1 | darwin | arm64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@5.1.1 gyp info using node@16.13.1 | darwin | arm64 gyp info find Python using Python version 2.7.16 found at “/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python” (node:62311) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only. (Use node --trace-deprecation ... to show where the warning was created) gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python gyp info spawn args [ gyp info spawn args ‘/Users/sc/solana-mint/metaplex/js/node_modules/node-gyp/gyp/gyp_main.py’, gyp info spawn args ‘binding.gyp’, gyp info spawn args ‘-f’, gyp info spawn args ‘make’, gyp info spawn args ‘-I’, gyp info spawn args ‘/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/config.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘/Users/sc/solana-mint/metaplex/js/node_modules/node-gyp/addon.gypi’, gyp info spawn args ‘-I’, gyp info spawn args ‘/Users/sc/Library/Caches/node-gyp/16.13.1/include/node/common.gypi’, gyp info spawn args ‘-Dlibrary=shared_library’, gyp info spawn args ‘-Dvisibility=default’, gyp info spawn args ‘-Dnode_root_dir=/Users/sc/Library/Caches/node-gyp/16.13.1’, gyp info spawn args ‘-Dnode_gyp_dir=/Users/sc/solana-mint/metaplex/js/node_modules/node-gyp’, gyp info spawn args ‘-Dnode_lib_file=/Users/sc/Library/Caches/node-gyp/16.13.1/<(target_arch)/node.lib’, gyp info spawn args ‘-Dmodule_root_dir=/Users/sc/solana-mint/metaplex/js/node_modules/canvas’, gyp info spawn args ‘-Dnode_engine=v8’, gyp info spawn args ‘–depth=.’, gyp info spawn args ‘–no-parallel’, gyp info spawn args ‘–generator-output’, gyp info spawn args ‘build’, gyp info spawn args ‘-Goutput_dir=.’ gyp info spawn args ] /bin/sh: pkg-config: command not found gyp: Call to ‘pkg-config pixman-1 --libs’ returned exit status 127 while in binding.gyp. while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess.onCpExit (/Users/sc/solana-mint/metaplex/js/node_modules/node-gyp/lib/configure.js:351:16) gyp ERR! stack at ChildProcess.emit (node:events:390:28) gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12) gyp ERR! System Darwin 20.3.0 gyp ERR! command “/usr/local/bin/node” “/Users/sc/solana-mint/metaplex/js/node_modules/node-gyp/bin/node-gyp.js” “configure” “–fallback-to-build” “–module=/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/Release/canvas.node” “–module_name=canvas” “–module_path=/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/Release” “–napi_version=8” “–node_abi_napi=napi” “–napi_build_version=0” “–node_napi_label=node-v93” gyp ERR! cwd /Users/sc/solana-mint/metaplex/js/node_modules/canvas gyp ERR! node -v v16.13.1 gyp ERR! node-gyp -v v5.1.1 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/local/bin/node /Users/sc/solana-mint/metaplex/js/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/sc/solana-mint/metaplex/js/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93’ (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/sc/solana-mint/metaplex/js/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23) node-pre-gyp ERR! stack at ChildProcess.emit (node:events:390:28) node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1064:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) node-pre-gyp ERR! System Darwin 20.3.0 node-pre-gyp ERR! command “/usr/local/bin/node” “/Users/sc/solana-mint/metaplex/js/node_modules/canvas/node_modules/.bin/node-pre-gyp” “install” “–fallback-to-build” node-pre-gyp ERR! cwd /Users/sc/solana-mint/metaplex/js/node_modules/canvas node-pre-gyp ERR! node -v v16.13.1 node-pre-gyp ERR! node-pre-gyp -v v1.0.7 node-pre-gyp ERR! not ok

i’ve tried everything from trying to download this https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v93-darwin-unknown-arm64.tar.gz as suggested from the error, i tried to run yarn install in js nothing.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

5reactions
ezdouglascommented, Jan 19, 2022

The issue is that you are using wrong version of node.

TO EVERYONE FACING A PROBLEM WITH NPM INSTALL NPM RUN GENERATE

I HAVE FOUND A FIX for MAC USERS M1!

1- Open terminal and type: nvm --version if you don’t have nvm then you must install it with: curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash

it is vital that you RESTART TERMINAL after this step.

2- Open terminal again and run: 

nvm install v16.13.0

3- re-download the source code from this github and open it in Visual Studio Code, do not open the past folder you had because most likely you have the modules installed already, just redownload and open a new folder.

4- in Visual Studio Code, press New Terminal

5- Run this code: nvm use v16.13.0

then If you don’t have homebrew installed then install it with this command: (it can take 15 mins to install homebrew). 
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 
and then you must install the packages by running: 
eval $(/opt/homebrew/bin/brew shellenv)brew install pkg-config cairo pango libpng jpeg giflib librsvg

if you have the packages already installed then use: eval $(/opt/homebrew/bin/brew shellenv) brew reinstall pkg-config cairo pango libpng jpeg giflib librsvg

now Run: brew install yarn then yarn install then npm i then npm run generate

Everything should work now! If you have any error still, I am happy to help! It took me 5 hours to figure it out but I finally did.

3reactions
fazofazaalcommented, Dec 26, 2021

I’ve been able to solve the issue, just use the node version specified on the readme, which is a release of version 14. The project includes .nvmrc file which specifies the version. So you can use nvm (node version manager) to install the specified version by running “nvm use”. Make sure that you have selected the right version by running “node -v”. The most important thing you need to know is that this version is not compatible with ARM64 (M1) architecture and only works with x86 architectures. So you need to run your terminal through Rosetta translation layer provided by appple. So as long as your terminal or vscode integrated terminal is being run via Rosetta, it should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn install
yarn install is used to install all dependencies for a project. This is most commonly used when you have just checked out code...
Read more >
How To Install and Use the Yarn Package Manager for Node.js
Yarn has a unique way of installing and running itself in your JavaScript projects. First you install the yarn command globally, ...
Read more >
Why can't I run yarn start? - Stack Overflow
Try running npm ls eslint in your project folder. This will tell you which other package (apart from the expected react-scripts) installed ......
Read more >
4 Methods for How to Install Yarn on Windows Server
To confirm Yarn installed correctly, check the version in the Windows Command Prompt (CMD). A quick way to access it is by the...
Read more >
How to Install Yarn on Windows - phoenixNAP
1. Open the PowerShell as an administrator. · 2. Install Yarn by running the following command: npm install --global yarn. Install Yarn using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found