node.jsbrunchpixi.js

Node & Brunch & PIXI.js on Windows, module "querystring" not found


I'm having troubles setting up a PIXI project on my Windows machine.

It's very easy to reproduce:

npm install -g brunch

brunch new .

npm install --save-dev pixi.js

Then insert require("pixi.js") somewhere (e.g. initialize.js), and

npm run start

Open localhost:3333 and there's the following error:

Uncaught Error: Cannot find module 'querystring' from 'url/url.js'
    at require (app.js:61)
    at expanded (app.js:34)
    at app.js:147
    at url.js:104
    at url.js:737
    at initModule (app.js:42)
    at require (app.js:59)
    at expanded (app.js:34)
    at app.js:147
    at determineCrossOrigin.js:10

It works perfectly on a Linux machine (debian), but I always get this error on my Windows machine.

$ node -v
v6.9.5

$ npm -v
4.2.0

$ systeminfo | grep "OS"
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.14393 N/A Build 14393

The troubling module is pixi. If I install and require any other module, it works fine. It also doesn't work if I install the querystring explicitly (npm install querystring), although it's a built-in module.

Any ideas?


Solution

  • I've got it resolved by using bower. It's a workaround though.

    npm install -g bower

    bower install --save pixi.js

    Then the PIXI object will be available globally out of the box. Just use it in your code.