Backstage: yarn install doesn't works on Mac

Created on 11 Jul 2020  路  3Comments  路  Source: backstage/backstage

yarn install fails* with following error. This, in turn is causing yarn start inside packages/backend to fail.

*: packages/backend is created containing relevant files, but the following error shows up in logs

Logs for yarn install at Project Root

Traceback (most recent call last):
  File "./gyp-mac-tool", line 611, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./gyp-mac-tool", line 28, in main
    exit_code = executor.Dispatch(args)
  File "./gyp-mac-tool", line 43, in Dispatch
    return getattr(self, method)(*args[1:])
  File "./gyp-mac-tool", line 246, in ExecFilterLibtool
    if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make:
*** [Release/ssh2.a] Error 1
gyp
ERR! build error
gyp
ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/prakash/personal/backstage/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp
ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 18.7.0
gyp
ERR! command "/Users/prakash/homebrew/Cellar/node/13.7.0/bin/node" "/Users/prakash/personal/backstage/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release/nodegit.node" "--module_name=nodegit" "--module_path=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v79"
gyp ERR! cwd /Users/prakash/personal/backstage/node_modules/nodegit
gyp ERR! node -v v13.7.0
gyp ERR!
node-gyp -v v4.0.0
gyp ERR! not ok
node-pre-gyp
ERR! build error
node-pre-gyp ERR!
stack Error: Failed to execute '/Users/prakash/homebrew/Cellar/node/13.7.0/bin/node /Users/prakash/personal/backstage/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v79' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/prakash/personal/backstage/node_modules/nodegit/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
node-pre-gyp
ERR! stack     at maybeClose (internal/child_process.js:1026:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp
ERR! System Darwin 18.7.0
node-pre-gyp ERR!
command "/Users/prakash/homebrew/Cellar/node/13.7.0/bin/node" "/Users/prakash/personal/backstage/node_modules/nodegit/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/prakash/personal/backstage/node_modules/nodegit
node-pre-gyp ERR! node -v v13.7.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR!
not ok
Failed to execute '/Users/prakash/homebrew/Cellar/node/13.7.0/bin/node /Users/prakash/personal/backstage/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release/nodegit.node --module_name=nodegit --module_path=/Users/prakash/personal/backstage/node_modules/nodegit/build/Release --napi_version=5 --node_abi_nap

Logs for yarn start inside packages/build

internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module '../build/Debug/nodegit.node'
Require stack:
- /Users/prakash/personal/backstage/node_modules/nodegit/dist/nodegit.js
- /Users/prakash/personal/backstage/packages/backend/dist/main.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/prakash/personal/backstage/node_modules/nodegit/dist/nodegit.js:19:12)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/prakash/personal/backstage/node_modules/nodegit/dist/nodegit.js',
    '/Users/prakash/personal/backstage/packages/backend/dist/main.js'
  ]
}

Expected Behavior

  • yarn install at top level shouldn't be showing any errors
  • yarn start inside packages/backend/ should've worked flawlessly.

Current Behavior

Backend is not starting due to error in yarn install at project root.

Steps to Reproduce

  1. run yarn install inside Project Root directory
  2. run yarn start in packages/backend/

This will reproduce both error logs.

Make sure that you're running the steps in the environment described below

Solution

Used docker with ubuntu 18.04 as base image. Works fine.

Context

Just trying to run the tool. Haven't changed anything in the source.

Your Environment

  • NodeJS Version: v13.7.0
  • Operating System and Version: Mac OSX 10.14.6
  • Browser Information: N/A
  • Yarn Version: 1.21.1
bug

All 3 comments

Some node 13 versions are partially broken it seems, exhibiting these node-gyp errors. Some googling may lead to hints on how to correct it, but the recommended fix for now is to try again with the LTS version of node (12.x) instead.

I also ran into this a while back. From my investigation it鈥檚 specifically a problem with the nodegit package only supporting up to node 12. I鈥檓 wondering if it might make sense to lock down the engine versions in package.json to node 12. Right now it鈥檚 set to >= 12.

I actually have it working on 13.something on my own work Macbook (am on vacation so can't check more specifically at the moment). Made it work somehow :) But yeah, locking it down may lead to fewer surprises.

Was this page helpful?
0 / 5 - 0 ratings