2

I'm trying to run an app (I will work on) using:

yarn start

But I'm getting the error:

ts-node ./src/engine/server/server
Error: Cannot find module 'contextify'
  at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
  at Function.Module._load (internal/modules/cjs/loader.js:506:25)
  at Module.require (internal/modules/cjs/loader.js:636:17)
  at require (internal/modules/cjs/helpers.js:20:18)
  at Object.<anonymous> (/Users/aa/Documents/app/node_modules/jsdom/lib/jsdom/browser/index.js:5:21)
  at Module._compile (internal/modules/cjs/loader.js:688:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
  at Module.load (internal/modules/cjs/loader.js:598:32)
  at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
  at Function.Module._load (internal/modules/cjs/loader.js:529:3)

The dependency contextify is not in package.json. I tried different Node versions but I'm getting the same. The app is in TypeScript using Webpack. I use a Mac. Any idea?

Lee Maan
  • 699
  • 3
  • 10
  • 30
  • Do you have any errors when using npm install ? – JFPicard Dec 03 '18 at 13:30
  • @JFPicard when I run `npm install` I get the error `gyp ERR! stack Error: 'gyp' failed with exit code: 1` and after that if I run `yarn start` I get another error `err = new Error('Could not locate the bindings file. Tried:\n'` but when I install using `yarn install` I get the above-mentioned error. The owner is already running the app using `yarn`, so the problem is in my machine (Mac). – Lee Maan Dec 03 '18 at 13:44

2 Answers2

1

The gyp error is probably comming from three of theses things:

1) Python not installed:

  • Install Python 2.7
  • Set npm to find python: npm config set python <python.path>\python.exe where python.path is the path where you've installed python (ex. C:\Python2.7)

2) Behind a firewall / proxy

  • Use the command: npm config set proxy <proxyUrl>

3) Problem with node-sass The problem occurs when the proxy blocks the node-sass files.

You maybe need to change the file since sometimes it ask for win32-x64-59_binding.node

JFPicard
  • 5,029
  • 3
  • 19
  • 43
  • Thanks for the answer but I forgot to mention I'm using a Mac. I tried the first solution but it didn't work. The second doesn't apply since I'm not behind a proxy. I'm running the server locally. The third is irrelevant since it's about Windows. – Lee Maan Dec 03 '18 at 19:42
  • Maybe this can help: https://stackoverflow.com/questions/38058386/why-is-node-gyp-rebuild-failing-on-mac-osx-el-capitan – JFPicard Dec 03 '18 at 19:43
  • This issue seems to be big! Node-gyp, yarn, etc... it never worked :( – Lee Maan Dec 04 '18 at 07:48
1

The problem turned out to be a Node 6.x.x. C++ compiling configuration problem. This comment solved it for me.

Lee Maan
  • 699
  • 3
  • 10
  • 30