phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.22k stars 7.1k forks source link

Cannot build #3060

Closed rjamesnw closed 7 years ago

rjamesnw commented 7 years ago

I think you are missing a step in your instructions on this page in the "Download from NPM" section (doesn't build as easily as described): https://phaser.io/phaser3/gettingstarted

I did this:

  1. Made sure I have the latest NodeJS.
  2. Latest update of NPM.
  3. npm install phaser@beta
  4. npm install
  5. npm run build

Then I get this:

phaser>npm run build

> phaser@3.0.0-beta.2 build ...node_modules\phaser
> webpack

module.js:529
    throw err;
    ^

Error: Cannot find module 'is-fullwidth-code-point'
    at Function.Module._resolveFilename (module.js:527:15)
    at Function.Module._load (module.js:476:23)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (...node_modules\phaser\node_modules\string-width\index.js:3:30)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phaser@3.0.0-beta.2 build: `webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phaser@3.0.0-beta.2 build script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!    ...AppData\Roaming\npm-cache\_logs\2017-09-20T22_13_
21_705Z-debug.log

Any ideas?

microcipcip commented 7 years ago

I have the same problem. It seems that you have to cd to node_modules/phaser and then npm i and npm run build. Then it will create a ../../phaser3-examples folder.

This means that you have a node_modules inside node_modules....maybe this is just a temporary setup?

photonstorm commented 7 years ago

You shouldn't need to do this. I'm curious what the is-fullwidth-code-point module is. That isn't something Phaser uses. I thought maybe the webpack-shell-plugin used it, but it doesn't seem to.

I have updated the copy-to-examples shell script today, so it will check to see if you've got the Phaser 3 Examples repo locally before trying to copy to it, and fail gracefully if you don't. It might have just been that which was causing it. Have released beta3 today, so might be worth testing against that?

microcipcip commented 7 years ago

The point is that npm run build won't work because there is no package.json file in the folder after running those commands in the guide. I only have node_modules and package-lock.json so the package.json needs to be added manually?

photonstorm commented 7 years ago

True. That's really weird because all of those things exist. It must be a limitation of publishing a package from within a sub-folder. Or something is wrong in the package.json we're using, although I can't see what, it's really basic.

photonstorm commented 7 years ago

Yeah, appears it can't be done: https://stackoverflow.com/questions/38935176/how-to-npm-publish-specific-folder-but-as-package-root

For now, I'll update the guide until we move over the v3 folder to be the root of the repo in the coming weeks.

rjamesnw commented 7 years ago

Just did npm update then npm run build inside node_modules\phaser and it works now, thanks. ;)

photonstorm commented 7 years ago

I updated the getting started guide today and also the webpack project template to address the issues raised here, so am closing for now.