mapgen4
mapgen4 copied to clipboard
Error: Cannot find module '@redblobgames/prng'
Is it ok, that after doing instructions for nom I have the next error?
Error: Cannot find module '@redblobgames/prng'
P.S.: thnx a lot for the blog and the source code!
Oh interesting, it should've found it. This works for me:
git clone --depth 1 https://github.com/redblobgames/mapgen4.git
npm install
and this also worked for me
git clone --depth 1 https://github.com/redblobgames/mapgen4.git
yarn install
However I'm a newbie with npm stuff and there could be something about my configuration that I'm forgetting. Can you tell me what commands you ran and where that error occurred? Thanks!
@redblobgames yeah, I've noticed that the yarn instruction works perfectly! Regarding NPM, I think it might be because of the different versions of NPM/Node.js used by me and you. It might be good idea to add information about the node.js / npm into the requirements of the project.
Oh interesting, I haven't paid attention to the versions. Sure, I can add information about the node.js / npm version, but I am not sure which versions don't work. What version of Node/NPM do you use? The mapgen4 npm install worked for me with these versions:
- node 4.2.6 / npm 3.5.2
- node 8.10 / npm 3.5.2
- node 16.14 / npm 8.3
- node 18.7 / npm 8.15
But esbuild doesn't seem to work with node 8 / npm 3.5.2. I think an esbuild alternative may work for older versions of node (browserify? webpack? rollup? not sure).
@redblobgames my versions are Node.js: 14.8.0, NPM: 6.14.7
Aha, so there is an issue with my package.json. Try changing the version number from 1.1 in my package.json to 1.1.0. After that, Node and NPM works for me (on Linux, at least)
$ node --version
v14.8.0
$ npm --version
6.14.7
$ git clone --depth 1 https://github.com/redblobgames/mapgen4.git
$ cd mapgen4
$ # edit package.json version number from 1.1 to 1.1.0
$ npm install
added 10 packages from 7 contributors and audited 10 packages in 2.703s
found 0 vulnerabilities
Unfortunately I don't know enough about node/npm to be able to say why it can't find the prng on your system. :-( I will fix the version number problem, though.