Jump to content

phaser@beta: npm run build problem


digitsensitive
 Share

Recommended Posts

Hello there!

I did install Phaser 3 Beta over npm as described with npm install phaser@beta. This worked fine but when I try to run npm run build in the phaser folder after executing npm update I get the following error:

module.js:487
    throw err;
    ^

Error: Cannot find module 'webpack-shell-plugin'
    at Function.Module._resolveFilename (module.js:485:15)
    at Function.Module._load (module.js:437:25)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/XXX/XXX/XXX/XXX/XXX/node_modules/phaser/webpack.config.js:4:28)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `webpack`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /XXX/XXX/.npm/_logs/2017-10-20T14_47_59_128Z-debug.log

Is somebody else having the same error?

Thank you in advance!

Eric

Link to comment
Share on other sites

  • 2 months later...

@RiCoTeRoX That won't quite work as you still won't have Phasers' dev dependencies.

@WizaEric Following on from the above, why are you trying to build Phaser? Assets on npm are expected to be built and consumable assets, there is no enforcement on this, but usually this is the case. Webpack is a development dependency for most libraries, not an actual dependency, if this is true for Phaser (it likely is), then when you install Phaser npm will recursively install its dependencies (it actually has none), but, crucially, not its development dependencies as they are not required.

Rather than installing Phaser as a dependency via npm, if you want to build it you should clone the repository and build from source.

There's a really detailed guide on getting started in the repo.

edit: I did see that Phaser doesn't export its distributable files to npm, which is a little odd, I've never encountered this pattern before, but I think its just that the source is already distributable, which is actually awesome. Generally anything inside `node_modules` should not be touched, but, the problem is simply that you don't have the dependencies to do the build.

Phaser will route through any `import Phaser from 'phaser` to `./src/phaser.js` so building isn't going to be very useful for you but, run `npm install` inside the phaser directory then `npm run build` and you'll get a `./dist/phaser.js`, you'd then either want to change the package to point at the built file or use something like `import Phaser from 'phaser/dist/phaser'` to get it, but, I don't think you'd need this file anyway if you're going down the npm and modules route.

Link to comment
Share on other sites

@RiCoTeRoX Yeah I missed that you were manually running yarn inside the dependency to grab those dev deps.

Is there a reason why you'd want to build from the dependency? Is it just that it isn't yet available anywhere else as a built dep?

Just interested as the build script seems to just minify things up, which you'd probably be doing anyway? I'm not totally clear on what webpack does out of the box, is there more that is desirable about building it yourself vs including it from /src?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...