drcasas2
drcasas2

Reputation: 1

Trouble installing the create-react-app Must-Have-Libraries using yarn or npx; node-gyp, node-sass, or dependency problem?

I tried using the following commands in my project folder's terminal to follow along with a book I am learning from, titled "Integrating D3.js with React: Learn to Bring Data Visualization to Life":

yarn create react-app react-d3-hello-world --template must-have-libraries

or

npx create-react-app react-d3-hello-world --template must-have-libraries

It aborts the installation, and gives the following errors below. How do I resolve this issue?:

`yarn create v1.22.21
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Installed "[email protected]" with binaries:
      - create-react-app
[###################################################################] 67/67
Creating a new React app in /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template-must-have-libraries...

yarn add v1.22.21
info No lockfile found.
warning Workspaces can only be enabled in private projects.
[4/4] 🔨  Building fresh packages...
[-/15] ⠄ waiting...
[-/15] ⠄ waiting...
[-/15] ⠄ waiting...
[4/15] ⠄ node-sass
error /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass
Output:
Building: /usr/local/bin/node /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
gyp verb check python version `/Library/Frameworks/Python.framework/Versions/2.7/bin/python2 -c "import sys; print "2.7.18
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 20.12.1
gyp verb command install [ '20.12.1' ]
gyp verb install input version string "20.12.1"
gyp verb install installing version: 20.12.1
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 20.12.1
gyp verb build dir attempting to create "build" dir: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/config.gypi
gyp verb common.gypi checking for gypi file: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /Library/Frameworks/Python.framework/Versions/2.7/bin/python2
gyp info spawn args [
gyp info spawn args   '/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/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/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/davidcasas/.node-gyp/20.12.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/davidcasas/.node-gyp/20.12.1',
gyp info spawn args   '-Dnode_gyp_dir=/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/davidcasas/.node-gyp/20.12.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass',
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 ]
gyp: Undefined variable standalone_static_library 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/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp/lib/configure.js:345:16)
gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Darwin 22.6.0
gyp ERR! command "/usr/local/bin/node" "/Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name/node_modules/node-sass
gyp ERR! node -v v20.12.1
gyp ERR! node-gyp -v v3.8.0

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts cra-template-must-have-libraries --cwd /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book/your-project-name has failed.

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting your-project-name/ from /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book
Done.
error Command failed.
Exit code: 1
Command: /usr/local/bin/create-react-app
Arguments: your-project-name --template must-have-libraries
Directory: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
`

I'm not sure if this helps, but I also have anaconda3 installed on my system, so maybe anaconda3 is interfering with the PATHs for this installation? I don't know, I'm fairly new, but I wanted to see if that would help solve the problem.

I tried everything I could possibly think of, so any help would be great!

Thank you so much,

David

I tried downloading a version of python2, installing gcc, updating node.js and npm, installed Xcode, cleared my npm and yarn caches, updated node-gyp (not sure what that is), tried to use the 'node-gyp configure --rebuild' command (and it gave me this following error:

gyp: binding.gyp not found (cwd: /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book) while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gypfailed with exit code: 1 gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-gyp/lib/configure.js:297:18) gyp ERR! stack at ChildProcess.emit (node:events:518:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12) gyp ERR! System Darwin 22.6.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "configure" "--rebuild" gyp ERR! cwd /Users/davidcasas/Documents/Coding/DataViz/ReactD3Book gyp ERR! node -v v20.12.1 gyp ERR! node-gyp -v v10.1.0 gyp ERR! not ok )

Upvotes: 0

Views: 110

Answers (0)

Related Questions