【问题标题】:Node & Brunch & PIXI.js on Windows, module "querystring" not foundWindows 上的 Node & Brunch & PIXI.js,找不到模块“querystring”
【发布时间】:2018-12-21 19:24:11
【问题描述】:

我在我的 Windows 机器上设置 PIXI 项目时遇到问题。

很容易复制:

npm install -g brunch

brunch new .

npm install --save-dev pixi.js

然后在某处插入require("pixi.js")(例如initialize.js),然后

npm run start

打开localhost:3333,出现如下错误:

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

它在 Linux 机器 (debian) 上完美运行,但在我的 Windows 机器上总是出现此错误。

$ 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

麻烦的模块是pixi。如果我安装并需要任何其他模块,它工作正常。如果我显式安装查询字符串 (npm install querystring),它也不起作用,尽管它是一个内置模块。

有什么想法吗?

【问题讨论】:

  • 我试过了,没问题。没有提出任何投诉。也许您安装了“损坏/错误”的 npm 模块。我认为尝试清除它并重新安装它们可能是值得的:stackoverflow.com/a/34344080/1523545
  • @Hachi 你好,我认为是 Windows 问题。上述指令在 linux 上完美运行。

标签: node.js brunch pixi.js


【解决方案1】:

我已经通过使用 bower 解决了这个问题。不过,这是一种解决方法。

npm install -g bower

bower install --save pixi.js

然后 PIXI 对象将在全球范围内开箱即用。只需在您的代码中使用它即可。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-19
    • 1970-01-01
    • 2022-06-16
    • 1970-01-01
    • 2017-04-01
    • 2017-04-16
    相关资源
    最近更新 更多