mapbox / node-pre-gyp

Node.js tool for easy binary deployment of C++ addons
BSD 3-Clause "New" or "Revised" License
1.11k stars 259 forks source link

heroku node deployment(react-boilerplate) sh: 1: node-pre-gyp: not found error #423

Open shsunmoonlee opened 5 years ago

shsunmoonlee commented 5 years ago

I'm getting error when deploying react-boilerplate on heroku with feathers, nodejs, mongodb, react. I specified up to date versions in package.json, and tried building with both npm and yarn but both fail. I appreciate your help!

  "engines": {
    "npm": ">=6.4.1",
    "node": ">=v8.12.0",
    "yarn": ">=1.10.1"
  },

trial 1: install with npm. error: sh: 1: node-pre-gyp: not found

   NPM_CONFIG_LOGLEVEL=error
   NPM_CONFIG_PRODUCTION=true
   YARN_PRODUCTION=false
   NODE_VERBOSE=false
   NODE_ENV=production
   NODE_MODULES_CACHE=true

-----> Installing binaries
       engines.node (package.json):  >=v8.12.0
       engines.npm (package.json):   >=6.4.1

   Resolving node version >=v8.12.0...
   Downloading and installing node 10.12.0...
   Bootstrapping npm >=6.4.1 (replacing 6.4.1)...
   npm >=6.4.1 installed
   Resolving yarn version >=1.10.1...
   Downloading and installing yarn (1.12.0)...
   Installed yarn 1.12.0

   > grpc@1.15.1 install /tmp/build_e7799f363b624e57eda6680a757c4fd4/node_modules/grpc
   > node-pre-gyp install --fallback-to-build --library=static_library

   sh: 1: node-pre-gyp: not found
   npm ERR! file sh
   npm ERR! code ELIFECYCLE
   npm ERR! errno ENOENT
   npm ERR! syscall spawn
   npm ERR! grpc@1.15.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
   npm ERR! spawn ENOENT
   npm ERR! 
   npm ERR! Failed at the grpc@1.15.1 install script.
   npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

trial 2: install with yarn. error: Error: spawn webpack ENOENT

       NPM_CONFIG_LOGLEVEL=error
       YARN_PRODUCTION=true
       NODE_VERBOSE=false
       NODE_ENV=production
       NODE_MODULES_CACHE=true

-----> Installing binaries
       engines.node (package.json):  >=v8.12.0
       engines.npm (package.json):   >=6.4.1
       engines.yarn (package.json):  >=1.10.1

       Resolving node version >=v8.12.0...
       Downloading and installing node 10.12.0...
       Bootstrapping npm >=6.4.1 (replacing 6.4.1)...
       npm >=6.4.1 installed
       Resolving yarn version >=1.10.1...
       Downloading and installing yarn (1.12.0)...
       Installed yarn 1.12.0

       > seunghunlee-software@3.6.0 build /tmp/build_edb00e4a7279e6636f35f9ea79a9d0f8
       > cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout

events.js:167
      throw er; // Unhandled 'error' event
      ^
Error: spawn webpack ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Cactusbone commented 5 years ago

To workaround a similar problem (node-pre-gyp not found on path), I added node-pre-gyp as a direct dependency, It seems to be a path problem, probably linked to where npm install dependencies