Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build project on Node version 18 and above #100

Closed
TechhDan opened this issue Dec 8, 2022 · 11 comments
Closed

Unable to build project on Node version 18 and above #100

TechhDan opened this issue Dec 8, 2022 · 11 comments

Comments

@TechhDan
Copy link

TechhDan commented Dec 8, 2022

The project does not build on newer versions of node. I tried on Node version 18.12.1 and 19.1.0. I had to revert Node to LTS Gallium 16.18.1 for the project to build.

npm start

> phaser3-project-template@1.1.2 start
> webpack-dev-server --config webpack/base.js --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /var/www/html/games/demo
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/var/www/html/games/demo/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:471:10)
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:503:5
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:358:12
    at /var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/var/www/html/games/demo/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:471:10)
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:503:5
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:358:12
    at /var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:205:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.12.1
@firstygoldfish
Copy link

For reference, also an issue in 17

Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:135:10)
.
.
.
at iterateNormalLoaders (/home/carl/game1/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array. (/home/carl/game1/node_modules/loader-runner/lib/LoaderRunner.js:205:4) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.9.1

@john-farina
Copy link

Ran into the same issue, using nvm to install node v16.18.1 worked. Thanks!

@connorbrez
Copy link

Running into this issue as well

@jonathan-rose
Copy link

jonathan-rose commented Apr 8, 2023

Also having this issue. Most of the advice you find online for resolving this suggests either downgrading to Node 16 or using legacy SSL (for example). These solutions are both insecure and a bit intimidating for newbies who might be coming to Phaser for the first time. Trying to fix it by forcing an update of packages also does not work, as it starts giving errors about upstream dependency conflicts.

@base-e
Copy link

base-e commented Jun 7, 2023

The fix without downgrading the node version is to run
npm install webpack@latest

Then update the webpack-cli using the force tag
npm install webpack-cli@latest --force

this worked with node 18.16.0 and npm 9.5.1

@elvisMat
Copy link

elvisMat commented Jul 1, 2023

The project does not build on newer versions of node. I tried on Node version 18.12.1 and 19.1.0. I had to revert Node to LTS Gallium 16.18.1 for the project to build.

npm start

> phaser3-project-template@1.1.2 start
> webpack-dev-server --config webpack/base.js --open

ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /
ℹ 「wds」: Content not from webpack is served from /var/www/html/games/demo
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/var/www/html/games/demo/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:471:10)
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:503:5
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:358:12
    at /var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:221:10)
node:internal/crypto/hash:71
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:71:19)
    at Object.createHash (node:crypto:133:10)
    at module.exports (/var/www/html/games/demo/node_modules/webpack/lib/util/createHash.js:135:53)
    at NormalModule._initBuildHash (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:417:16)
    at handleParseError (/var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:471:10)
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:503:5
    at /var/www/html/games/demo/node_modules/webpack/lib/NormalModule.js:358:12
    at /var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:373:3
    at iterateNormalLoaders (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
    at Array.<anonymous> (/var/www/html/games/demo/node_modules/loader-runner/lib/LoaderRunner.js:205:4) {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v18.12.1

Has anyone found solution to this

@elvisMat
Copy link

elvisMat commented Jul 1, 2023

The fix without downgrading the node version is to run npm install webpack@latest

Then update the webpack-cli using the force tag npm install webpack-cli@latest --force

this worked with node 18.16.0 and npm 9.5.1

After following your instructions and run npm start i am faced with the issue:
`> phaser3-project-template@1.1.2 start

webpack-dev-server --config webpack/base.js --open

clean-webpack-plugin: options.output.path not defined. Plugin disabled...
C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\html-webpack-plugin\index.js:59
compilation.hooks.htmlWebpackPluginAlterChunks = new SyncWaterfallHook(['chunks', 'objectWithPluginRef']);
^

TypeError: Cannot add property htmlWebpackPluginAlterChunks, object is not extensible
at C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\html-webpack-plugin\index.js:59:56
at Hook.eval [as call] (eval at create (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:19:10), :102:1)
at Hook.CALL_DELEGATE [as _call] (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\node_modules\tapable\lib\Hook.js:14:14)
at Compiler.newCompilation (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\lib\Compiler.js:1126:26)
at C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\lib\Compiler.js:1170:29
at Hook.eval [as callAsync] (eval at create (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\node_modules\tapable\lib\Hook.js:18:14)
at Compiler.compile (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\lib\Compiler.js:1165:28)
at C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\lib\Watching.js:218:19
at Hook.eval [as callAsync] (eval at create (C:\Users\MATHIBE\Documents\raps\phaser\tutorial\node_modules\webpack\node_modules\tapable\lib\HookCodeFactory.js:33:10), :15:1)

Node.js v18.14.2`

@SheW0lf
Copy link

SheW0lf commented Oct 12, 2023

I know this thread is a little stale, but to fix these issues, delete the node_modules folder if you already ran the install command, and delete the package-lock.json file, this is important! run npm install and then run npm start that should get things running.

The reason this works is because the lock file is for "locking" down the versions defined in the package.json file, so when npm install webpack-cli@latest --force was run, none of the other packages got updated that are needed with the latest webpack. Deleting the lock file now allows all the carrots (^) on the versions in the package.json file to look for the newest version and will download them now that the lock file isn't forcing them to remain on the original versions defined there.

@ClementineAccount
Copy link

Doesn't work for me. I followed the steps a few times and I get
Error: Cannot find module 'webpack-cli/bin/config-yargs'

I know this thread is a little stale, but to fix these issues, delete the node_modules folder if you already ran the install command, and delete the package-lock.json file, this is important! run npm install and then run npm start that should get things running.

The reason this works is because the lock file is for "locking" down the versions defined in the package.json file, so when npm install webpack-cli@latest --force was run, none of the other packages got updated that are needed with the latest webpack. Deleting the lock file now allows all the carrots (^) on the versions in the package.json file to look for the newest version and will download them now that the lock file isn't forcing them to remain on the original versions defined there.

photonstorm added a commit that referenced this issue Oct 24, 2023
Updated for Webpack 5, node 18.

Fix #30 #34 #45 #46 #100
@photonstorm
Copy link
Collaborator

This is fixed with v2.0.0 of this template.

@firstygoldfish
Copy link

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants