Lee Maan
Lee Maan

Reputation: 719

Node error: Cannot find module 'contextify' with Yarn and Webpack

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?

Upvotes: 2

Views: 703

Answers (2)

Lee Maan
Lee Maan

Reputation: 719

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

Upvotes: 1

JFPicard
JFPicard

Reputation: 5168

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

Upvotes: 1

Related Questions