Open JacobeMNA opened 2 years ago
My node version: node -v v16.14.2
My npm version: npm -v 8.5.5
@JacobeMNA you spelled the file name wrong. I think it should be node utils/nftport/uploadFiles.js
.
I copy and paste your command but that error repeated
'MODULE_NOT_FOUND' had a green color not red
@JacobeMNA can you paste the output of Get-ChildItem utils/nftport
please.
I am new I don't know how to do that could you describe more
I paste it in my terminal window and this answer came:
Directory: C:\Users\Mahdi\Downloads\hashlips_a
rt_engine-1.1.1_update\utils\nftport
Mode LastWriteTime Length N a m e
-a---- 3/21/2022 9:09 PM 1226 u p l o a d F i l e s . j s
@JacobeMNA try running node utils/nftport/uploadFiles.js
.
If that doesn't work, try running node 'u p l o a d F i l e s . j s'
(you need the newlines so copy/pase it)
ERRORS are different:
For second( node 'u p l o a d F i l e s . j s') I have:
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\u p l o a d F i l e s . j s'
at Function.Module._resolveFilename (node:
internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/mo
dules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runM
ain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:4
7 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
And for the first one:
C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js:2 const fetch = require('node-fetch'); ^
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\node_modules\node-fetch\src\index.js from C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js not supported.
Instead change the require of index.js in C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js to a dynamic import() which is available in all CommonJS modules.
at Object.
the second error is different and changed when i copy/paste your command in the compare of first time
Do you have any idea...?
What should I do now?
@JacobeMNA the first one worked then. Try changing the require('node-fetch');
on line 2 to import('node-fetch');
.
Done
What next?
This is the new error after running (node utils/nftport/uploadFiles.js)
C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js:24
fetch(url, options)
^
TypeError: fetch is not a function
at C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js:24:5
at Array.forEach (
at Module.load (node:internal/modules/c
js/loader:981:32)
at Function.Module._load (node:internal
/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as r
unMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:1
7:47
And this is the error when i running (node 'u p l o a d F i l e s . j s'):
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\u p l o a d F i l e s . j s'
at Function.Module._resolveFilename (no
de:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal
/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as r
unMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:1
7:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
@JacobeMNA can you paste lines 1-3 of utils/nftport/uploadFiles.js
please.
sure!
const FormData = require('form-data'); const fetch = import('node-fetch'); const path = require("path")
This is all of it if it need checking:
const FormData = require('form-data'); const fetch = import('node-fetch'); const path = require("path") const basePath = process.cwd(); const fs = require("fs");
fs.readdirSync(${basePath}/build/images
) .
forEach(file => {
const formData = new FormData();
const fileStream = fs.createReadStream(${basePath}/build/images/${file}
);
formData.append("file", fileStream);
let url = 'https://api.nftport.xyz/v0/files';
let options = {
method: "POST",
headers: {
Authorization:
},
body: formData
};
fetch(url, options)
.then((res) => res.json())
.then((json) => {
const fileName = path.parse(json.file_name).name;
let rawdata = fs.readFileSync(`${basePath}/build/json/${fileName}.jason`);
let metaData = JSON.parse(rawdata);
metaData.file_url = json.ipfs_url;
fs.writeFileSync(`${basePath}/build/json/${fileName}.json`,
JSON.stringify(metaData, null, 2));
console.log(`${json.file_name} uploaded & ${fileName}.json
updated!`);
})
.catch((err) => console.error("error:" + err));
});
@JacobeMNA change line 2 to const fetch = (await import('node-fetch')).default;
.
This is the error after running (node utils/nftport/uploadFiles.js)
C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadFiles.js:2
const fetch = (await import("node-fetch")).default
^^^^^^
SyntaxError: Unexpected token 'import' at Object.compileFunction (node:vm:352: 18) at wrapSafe (node:internal/modules/cjs/ loader:1032:15) at Module._compile (node:internal/modul es/cjs/loader:1067:27) at Module.load (node:internal/modules/c js/loader:981:32) at Function.Module._load (node:internal /modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as r unMain] (node:internal/modules/run_main:77:12) ) at node:internal/main/run_main_module:1 ) 7:47
And this is the error when i running (node 'u p l o a d F i l e s . j s'):
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\u p l o a d F i l e s . j s'
at Function.Module._resolveFilename (no
de:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal
/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as r
unMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:1
7:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }
Can I ask what is my next step please?
@JacobeMNA could you pastelines 1-3 please.
const FormData = require('form-data'); const fetch = (await import("node-fetch")).default const path = require("path")
should I use ( ; ) after default and ("path") ?
@JacobeMNA try asking in the repo you actually got the code from, presumably one of these.
How I am noob
where is repo? where I can ask?
I write this code on the codestakr first video about making 10000 uniqe images that daownload hashlips_art_engine v1.1.1
Now what I shoud ask about?
@JacobeMNA the error.
Is my code latest version of repository?
@JacobeMNA I don't know..
I changed my utiles/nftport/uploadFikes.js with the code you send for me now.
I mean this link: https://github.com/search?p=1&q=path%3A%2Futils%2Fnftport&type=Code
And steal have error... But I asking about : is that the latest version ?
Because that is a box need checking for sending my Bug report
thank you anyway man... your are in my heart and thanks for your time and trying. that is so valuable for me. hope you success and figure new things out in every moment of your life
Upgrade your NPM using this code in your Terminal:
npm i -g npm-upgrade
Everything must be fine after it.
@leonelcaroc a. a month has passed since this issue has been active b. the error has nothing to do with npm
did u get the answer, im having the same error, please help
@Jacob-alwin can you paste your error here please.
bonsoir j'avais cette meme erreur mais je reglais en changeant le chemin du fichier
run npm i, everything will be all right :-) on root folder
I am also getting same error . Can someone help?
2022-07-17T04:31:53.414823+00:00 heroku[web.1]: Starting process with command node /backend/server.js
2022-07-17T04:31:54.335598+00:00 app[web.1]: node:internal/modules/cjs/loader:936
2022-07-17T04:31:54.335635+00:00 app[web.1]: throw err;
2022-07-17T04:31:54.335635+00:00 app[web.1]: ^
2022-07-17T04:31:54.335636+00:00 app[web.1]:
2022-07-17T04:31:54.335636+00:00 app[web.1]: Error: Cannot find module '/backend/server.js'
2022-07-17T04:31:54.335636+00:00 app[web.1]: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
2022-07-17T04:31:54.335637+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:778:27)
2022-07-17T04:31:54.335637+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
2022-07-17T04:31:54.335638+00:00 app[web.1]: at node:internal/main/run_main_module:17:47 {
2022-07-17T04:31:54.335638+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2022-07-17T04:31:54.335638+00:00 app[web.1]: requireStack: []
2022-07-17T04:31:54.335638+00:00 app[web.1]: }
2022-07-17T04:31:54.451705+00:00 heroku[web.1]: Process exited with status 1
2022-07-17T04:31:54.556814+00:00 heroku[web.1]: State changed from starting to crashed
2022-07-17T04:31:54.563811+00:00 heroku[web.1]: State changed from crashed to starting
2022-07-17T04:32:07.670264+00:00 heroku[web.1]: Starting process with command node /backend/server.js
2022-07-17T04:32:08.638955+00:00 app[web.1]: node:internal/modules/cjs/loader:936
2022-07-17T04:32:08.638969+00:00 app[web.1]: throw err;
2022-07-17T04:32:08.638970+00:00 app[web.1]: ^
2022-07-17T04:32:08.638970+00:00 app[web.1]:
2022-07-17T04:32:08.638970+00:00 app[web.1]: Error: Cannot find module '/backend/server.js'
2022-07-17T04:32:08.638971+00:00 app[web.1]: at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
2022-07-17T04:32:08.638971+00:00 app[web.1]: at Function.Module._load (node:internal/modules/cjs/loader:778:27)
2022-07-17T04:32:08.638971+00:00 app[web.1]: at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
2022-07-17T04:32:08.638972+00:00 app[web.1]: at node:internal/main/run_main_module:17:47 {
2022-07-17T04:32:08.638972+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2022-07-17T04:32:08.638973+00:00 app[web.1]: requireStack: []
2022-07-17T04:32:08.638973+00:00 app[web.1]: }
@sheersh1111 what did you run?
This error has nothing to do with this repo, you should probably open an issue where you got this code from.
Upgrade your NPM using this code in your Terminal:
npm i -g npm-upgrade
Everything must be fine after it.
komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 % npm i -g npm-upgrade npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules/npm-upgrade npm ERR! errno -13 npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/npm-upgrade' npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/npm-upgrade'] { npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/usr/local/lib/node_modules/npm-upgrade' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/komp/.npm/_logs/2022-10-25T15_33_14_556Z-debug-0.log komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 %
@totalnoobzxc if you're trying to install something globally (-g
), you need write permissions for /usr/local/lib
(run sudo npm i -g npm-upgrade
instead).
I did use command you said sudo npm i -g npm-upgrade
And then I tried to use npm install :
komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 % npm install
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code 1
npm ERR! path /Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v111' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.6
npm ERR! node-pre-gyp info using node@19.0.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release/canvas.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v111-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v111-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.8.0 and node@19.0.0 (node-v111 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.8.0/canvas-v2.8.0-node-v111-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@19.0.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@19.0.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
npm ERR! gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/komp/Library/Caches/node-gyp/19.0.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/komp/Library/Caches/node-gyp/19.0.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/komp/Library/Caches/node-gyp/19.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp
failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v111"
npm ERR! gyp ERR! cwd /Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas
npm ERR! gyp ERR! node -v v19.0.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v111' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.
npm ERR! A complete log of this run can be found in: npm ERR! /Users/komp/.npm/_logs/2022-10-25T20_50_23_828Z-debug-0.log komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 %
npm run build command err: komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 % npm run build
hashlips_art_engine@1.1.1 build node index.js
node:internal/modules/cjs/loader:998 throw err; ^
Error: Cannot find module '/Users/komp/Documents/hashlips_art_engine-1.1.2_patch_v6/node_modules/sha1' Require stack:
Node.js v19.0.0 komp@MBP-Chigur hashlips_art_engine-1.1.2_patch_v6 %
@totalnoobzxc try downgrading your node.
how lul
большой тостер сос!!
hello I stuck in a problem with the end of the working by hashlips_art_engine update1.1.1. I almost done on build my NFTs and fallow all the steps with no problem to when the (upload to IPFS) came up...
I check my code twice and didnt find any problem.But when I opened my terminal and ran "node utils/nftport/uploadiles.js" an error happened.
This is the error:
node:internal/modules/cjs/loader:936 throw err; ^
Error: Cannot find module 'C:\Users\Mahdi\Downloads\hashlips_art_engine-1.1.1_update\utils\nftport\uploadiles.js' at Function.Module._resolveFilename (node: internal/modules/cjs/loader:933:15) at Function.Module._load (node:internal/mo dules/cjs/loader:778:27) at Function.executeUserEntryPoint [as runM ain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:4 7 { code: 'MODULE_NOT_FOUND', requireStack: [] }
my 10000 NFTs are ready but I don't know what to do