hashlips / generative-art-node Goto Github PK
View Code? Open in Web Editor NEWCreate generative art by using the canvas api and node js
License: MIT License
Create generative art by using the canvas api and node js
License: MIT License
When i try and run npm install under config.js in the terminal i get a bunch of err...
Same with npm init etc... I am on a mac. Anyone know the solution to this?
Anyone have a fix for this? I validated and node, npm, etc are all installed correctly.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]prebuild: [email protected]build: [email protected]
6 info lifecycle [email protected]
7 verbose lifecycle [email protected]build: unsafe-perm in lifecycle truebuild: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Eric\NFT_Gen2\generative-art-node\node_modules.bin;C:\Users\Eric\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\Eric\AppData\Local\Programs\Python\Python39;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Users\Eric\AppData\Local\Programs\Python\Python39;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Program Files;C:\Winnt;C:\WINDOWS\System32\Wbem;C:\Winnt\System32;C:\Program Files (x86)\Nmap;C:\Users\Eric\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Eric\AppData\Roaming\npm;C:\Users\Eric\AppData\Local\GitHubDesktop\bin
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]build: CWD: C:\Users\Eric\NFT_Gen2\generative-art-nodebuild: Args: [ '/d /s /c', 'node index.js' ]
10 silly lifecycle [email protected]
11 silly lifecycle [email protected]build: Returned: code: 1 signal: nullbuild: Failed to exec build script
12 info lifecycle [email protected]
13 verbose stack Error: [email protected] build: node index.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\Eric\NFT_Gen2\generative-art-node
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
18 verbose node v14.17.6
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: node index.js
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
is it possible to create 10,000 without the program crashing?
The rarity constant doesn't seem to be affecting the actual occurrence of outputs. Does anyone have a fix for this?
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: node index.js
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.
how to generate all combinations of layers?
Anyone know how to make the output have no duplications. Can someone help me with the code pls
I receive the below error when running "node index.js" from the root directory.
Steps to recreate
*On Windows
How to change or append name of the output file in the code ?
I need more documentation about the usage.
sorry for vagueness in title-
we have discovered this code through hustle millenial on youtube, we are very new to coding and have tried to follow this code line for line, however the code isn't visible in the video past around line 21. I had thought that possibly index.js and main.js are interchangeable, (since in the video, he had said he wrote it alongside hashlips), we were wondering if it is possible to see a copy of someone's index.js for reference on how to write it. ( Original copy of index.js and config.js were only 10 lines deep, as I said I am very new to coding so this may be a problem on how I extracted the file). Any and all help would be greatly appreciated, thank you in advance :) 👍
(https://user-images.githubusercontent.com/89998322/131891359-751a8bbd-bf94-4718-8a11-a9b4c3baa817.png)
I'm not very well versed in coding, but when I run the build it seems that no information from the config.js is being pulled. I've changed the format, the rarity, and the defaultEdition and it changes nothing. It still only gives me 5 editions. Also, when I rename a layer folder, it tells me that it is missing a directory even though I changed the directory name in the layersOrder. Any help with this? This code seems to be updated from the tutorial video with the addition of the config so any help would be greatly appreciated.
does anybody know where the output folder has gone. cannot find it?please help and thanks in advance.
Is the rarity actually working? Im not good at coding especially Js but if I look through the code I cant see where the superrare is used?
Hi guys I am quite new to code and it gives me this error. I did npm install. After that I did npm run build. But nothing seems to work. Can someone help me out? The log is below v
0 info it worked if it ends with ok
1 verbose cli [ '/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin/node',
1 verbose cli '/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]prebuild: [email protected]build: [email protected]
6 info lifecycle [email protected]
7 verbose lifecycle [email protected]build: unsafe-perm in lifecycle truebuild: PATH: /Users/rikhartgers/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/rikhartgers/Desktop/generative-art-node-main/node_modules/.bin:/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]build: CWD: /Users/rikhartgers/Desktop/generative-art-node-mainbuild: Args: [ '-c', 'node index.js' ]
10 silly lifecycle [email protected]
11 silly lifecycle [email protected]build: Returned: code: 1 signal: nullbuild: Failed to exec build script
12 info lifecycle [email protected]
13 verbose stack Error: [email protected] build: node index.js
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/Users/rikhartgers/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:189:13)
13 verbose stack at ChildProcess. (/Users/rikhartgers/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:189:13)
13 verbose stack at maybeClose (internal/child_process.js:978:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/rikhartgers/Desktop/generative-art-node-main
16 verbose Darwin 20.3.0
17 verbose argv "/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin/node" "/Users/rikhartgers/.nvm/versions/node/v11.5.0/bin/npm" "run" "build"
18 verbose node v11.5.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] build: node index.js
22 error Exit status 1
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Hello! I'm having this error pop up for me. I have tried several different ways to try and get around it, but it hasn't been successful. I've attempted to uninstall and reinstall both Node and VSC after downloading fresh installs from their websites, and restarting my computer. I've tried to rebuild with "npm rebuild bcrypt --update-binary" and while it worked for rebuilding dependencies, it did not seem to make a difference. I've also looked up a guide for using "./node_modules/.bin/electrion-rebuild" but that did not work either. I'm a little bit at a loss at what I should try next. Any advice or assistance is appreciated!
In case it is important, "npm rebuild" is not recognized but "npm install" works.
PS C:\Users[removed for privacy]\generative-art-opensource-main> node index.js
node:internal/modules/cjs/loader:1183
return process.dlopen(module, path.toNamespacedPath(filename));
^Error: The module '\?\C:\Users[removed for privacy]\generative-art-opensource-main\node_modules\canvas\build\Release\canvas.node'
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, usingnpm rebuild
ornpm install
).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at Object. (C:\Users[removed for privacy]\generative-art-opensource-main\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
code: 'ERR_DLOPEN_FAILED'
}
Miles and miles of errors with "unhandled promise rejections"
also, to add to the confusion i have generated a metadata file where it has selected the various layer/files, and stacked them together but then it doesn't generate any .png files
Can I contribute to the Readme file for you?
for example how do i say for layer X, i want the original layers to appear 80%, rare 15%, and super rare 5% of the time when i run the program.
Ive been setting rarities with the code such as "_sr" it shows in the metadata but does not change the frequency of how often that image appears. i was wanting to know how to set values for how rare a thing should be. such as this hat is super rare so should only appear 1% of the time. how do i do this?
keeps saying module not found after Ive typed in node index.js
Hi all,
I have test with 250 and i have 16 files with the same attributes.
Check done with metadata.json.
How is it possible ?
Thanks for your help.
Have a good day
I don't see an output location and I'm not familiar enough with coding to understand how to specify this.
Cannot run "node index.js"
and it shows "Error: Cannot find module 'canvas'"
How to solve it?
I noticed in the readme that there is an option to customize the rarity in the config file. Unfortunately, the documentation doesn't include the specific code required to customize the rarity. I want to customize the rarity of each layer/individual files to generate an NFT collection with corresponding rarity in the form of percentages. Any information regarding this subject would be greatly appreciated.
Hello folks, thanks for this awesome example
I was wondering if you have experience using generative art with games, maybe using frameworks like PhaserJS and if you can share some tips about that
I want to create some examples in my Codepen collection: https://codepen.io/collection/AQWqbV
Best,
Juan
If i try npm run build it gives me this:
0 verbose cli [
0 verbose cli 'C:\Program Files\nodejs\node.exe',
0 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
0 verbose cli 'run',
0 verbose cli 'build'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 3ms
6 timing config:load:builtin Completed in 3ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 0ms
10 timing config:load:file:C:\Users\edgar.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\edgar\AppData\Roaming\npm\etc\npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:validate Completed in 0ms
15 timing config:load:credentials Completed in 0ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 8ms
18 timing npm:load:configload Completed in 8ms
19 timing npm:load:setTitle Completed in 0ms
20 timing npm:load:setupLog Completed in 1ms
21 timing config:load:flatten Completed in 2ms
22 timing npm:load:cleanupLog Completed in 2ms
23 timing npm:load:configScope Completed in 0ms
24 timing npm:load:projectScope Completed in 0ms
25 timing npm:load Completed in 15ms
26 timing command:run-script Completed in 3ms
27 verbose stack Error: Missing script: "build"
27 verbose stack
27 verbose stack To see a list of scripts, run:
27 verbose stack npm run
27 verbose stack at RunScript.run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:104:13)
28 verbose cwd C:\Users\edgar
29 verbose Windows_NT 10.0.19042
30 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "build"
31 verbose node v16.8.0
32 verbose npm v7.21.0
33 error Missing script: "build"
33 error
33 error To see a list of scripts, run:
33 error npm run
34 verbose exit 1
thanks in advance
Is there a way to create editions randomly rarity? I noticed rarity is in chronological order.
Hi all - thanks in advance for any help.
I get a failure 'Error: Cannot find module 'canvas''
Can anyone tell me how to get and install this module please?
I have been using the code for a while but today VS updated and the code no long works well. I run it (node index.js) and it creates the editions. However, after all the editions are created it takes ages for the terminal to return and i dont know why.
Here is an error code i got. Its to do with unhandledpromise rejection which have changed in the new visual studio. Can anyone help?
(node:4868) UnhandledPromiseRejectionWarning: Error: UNKNOWN: unknown error, open './output/8.png'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at saveLayer (C:\Users\samaf\Documents\generative-art-node-main\index.js:15:6)
at drawLayer (C:\Users\samaf\Documents\generative-art-node-main\index.js:58:3)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:4868) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:4868) UnhandledPromiseRejectionWarning: Error: UNKNOWN: unknown error, open './output/8.png'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at saveLayer (C:\Users\samaf\Documents\generative-art-node-main\index.js:15:6)
at drawLayer (C:\Users\samaf\Documents\generative-art-node-main\index.js:58:3)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
(node:4868) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
Changed folder names, updated new PNG files and when running node index.js it generates 3 files lets say if i set 3 as default. But it always picks last random file in last layer directory in config. It does not use any other folder above it
For ex
backgrounds',
'glasses',
'faces'
here only 1 image from faces is used and backgrounds and glasses are not used
Is there a way to make the generated .png name a compilation of the layer names?
For example Layer1name_Layer2Name_Layer3Name.png
Thankyou!
This would significantly help out in the processing of the images.
i don't want to generate numbers in the output PNG, how can i change that?
Hey guys - If one of my layers is a gif, how could I generate the file output as a gif instead of a png? Appreciate any support.
How do you customize the rarity so that you can make a trait only appear 1 time out of 100 generated?
Hi all,
Any tips for how I customise rarity is src/config.js
Can I make it so that some layers only show 0.5% of the time, for example?
Also, what are the attributes for Original, Rare and SuperRare please and can they be changed or new categories added?
Thanks so much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.