metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.31k stars 6.27k forks source link

Error: Cannot find module './candy-machine-cli.ts' #979

Closed Deadstop1 closed 2 years ago

Deadstop1 commented 2 years ago

Everytime i try to run "npx ts-node ~/solana-mint/metaplex/js/packages/cli/src/candy-machine-cli.ts upload" I get this error can anyone help?

Error: Cannot find module './candy-machine-cli.ts' Require stack:

Deadstop1 commented 2 years ago

I have managed to pass this but now i am left with this:

% npx ts-node ~/solana/metaplex/js/packages/cli/src/candy-machine-cli.ts upload ./assets -e devnet -k ~/solana/test.json

Error: The module '/Users/.../solana/metaplex/js/node_modules/canvas/build/Release/canvas.node' was compiled against a different Node.js version using NODE_MODULE_VERSION 93. This version of Node.js requires NODE_MODULE_VERSION 102. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install). at Object.Module._extensions..node (node:internal/modules/cjs/loader:1179:18) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:999:19) at require (node:internal/modules/cjs/helpers:102:18) at Object. (/Users/.../solana/metaplex/js/node_modules/canvas/lib/bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) { code: 'ERR_DLOPEN_FAILED'

1Note-io commented 2 years ago

Hi,

Go to: /Users/.../solana/metaplex/js and try the following: 1: Run: yarn add @types/offscreencanvas OR Run: npm i @types/offscreencanvas

2: Rebuild everything.

More help can be found: https://stackoverflow.com/questions/50831981/how-to-use-offscreencanvas-in-typescript-project

This was a workaround that I think might work, this has NOT been tested.

Deadstop1 commented 2 years ago

Thanks for your help it has seemed to do something but met by another error tried to do what it asks but still not working

513 return new TSError(diagnosticText, diagnosticCodes) ^ TSError: ⨯ Unable to compile TypeScript: packages/cli/src/candy-machine-cli.ts:6:19 - error TS7016: Could not find a declaration file for module 'node-fetch'. '/Users/.../solana-mint/metaplex/js/node_modules/node-fetch/lib/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/node-fetch if it exists or add a new declaration (.d.ts) file containing declare module 'node-fetch';

6 import fetch from 'node-fetch';

packages/cli/src/candy-machine-cli.ts:226:31 - error TS2531: Object is possibly 'null'.

226             const thisSlice = config.data.slice(

packages/cli/src/candy-machine-cli.ts:354:7 - error TS2531: Object is possibly 'null'.

354 config.data.slice(247, 247 + 4),

packages/cli/src/candy-machine-cli.ts:877:22 - error TS7006: Parameter 'value' implicitly has an 'any' type.

877 function setLogLevel(value, prev) {

packages/cli/src/candy-machine-cli.ts:877:29 - error TS7006: Parameter 'prev' implicitly has an 'any' type.

877 function setLogLevel(value, prev) {



    at createTSError (/Users/zam/solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:513:12)
    at reportTSError (/Users/zam/solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:517:19)
    at getOutput (/Users/zam/solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:752:36)
    at Object.compile (/Users/zam/solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:968:32)
    at Module.m._compile (/Users/zam/solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:1056:42)
    at Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/.../solana-mint/metaplex/js/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
georgiod9 commented 2 years ago

Everytime i try to run "npx ts-node ~/solana-mint/metaplex/js/packages/cli/src/candy-machine-cli.ts upload" I get this error can anyone help?

Error: Cannot find module './candy-machine-cli.ts' Require stack:

  • /Users/_/solana-mint/metaplex/js/packages/cli/src/imaginaryUncacheableRequireResolveScript at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.resolve (node:internal/modules/cjs/helpers:108:19) at requireResolveNonCached (/Users/_/nodemodules/ts-node/dist/bin.js:321:16) at getProjectSearchDir (/Users//node_modules/ts-node/dist/bin.js:291:40) at main (/Users/zam/node_modules/ts-node/dist/bin.js:193:27) at Object. (/Users/_/node_modules/ts-node/dist/bin.js:351:5) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/***/solana-mint/metaplex/js/packages/cli/src/imaginaryUncacheableRequireResolveScript'

I just had the same issue. Solved it by doing cd metaplex/js/packages/cli/src and running ts-node ./candy-machine-cli.ts upload ./assets --env devnet -k <keypair-path>

You should have both assets folder and candy-machine-cli.ts in same directory, i.e in the metaplex/js/packages/cli/src directory

leastgs commented 2 years ago

I solved it by downgrading node.js

ArguableExorcist8 commented 2 years ago

throw err; ^

Error: Cannot find module './candy-machine-cli.ts' Require stack:

Node.js v17.3.0

ArguableExorcist8 commented 2 years ago

I solved it by downgrading node.js

I did that too, but didn't work

uzushitn commented 2 years ago

I just had the same issue. Solved it by doing cd metaplex/js/packages/cli/src and running ts-node ./candy-machine-cli.ts upload ./assets --env devnet -k <keypair-path>

You should have both assets folder and candy-machine-cli.ts in same directory, i.e in the metaplex/js/packages/cli/src directory

This worked for me

ArguableExorcist8 commented 2 years ago

ts-node ./candy-machine-cli.ts upload ./assets --env devnet -k

thanks but now its showing

[ERR] error: unknown command 'upload'

ArguableExorcist8 commented 2 years ago

node:internal/modules/cjs/loader:936 throw err; ^

Error: Cannot find module './candy-machine-cli.ts' Require stack:

i think this is the problem right

maginaryUncacheableRequireResolveScript

ArguableExorcist8 commented 2 years ago

both the assets and the candy-machine-cli.ts are in the same directory

this is the command i use, am root sh-3.2# ts-node ./candy-machine-cli.ts upload ./assets --env mainnet-beta -keypair ~/config/solana/mainnet-beta.json

and this is the error i get [ERR] error: unknown command 'upload'

Medienor commented 2 years ago

I have same issue! @ArguableExorcist8 ArguableExorcist8 did you find a solution?

ArguableExorcist8 commented 2 years ago

@Medienor not yet am still working on it, got some help from #1010 , will check on if i get the solution

AGhafaryy commented 2 years ago

Everytime i try to run "npx ts-node ~/solana-mint/metaplex/js/packages/cli/src/candy-machine-cli.ts upload" I get this error can anyone help?

Error: Cannot find module './candy-machine-cli.ts' Require stack:

  • /Users/_/solana-mint/metaplex/js/packages/cli/src/imaginaryUncacheableRequireResolveScript at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) at Function.resolve (node:internal/modules/cjs/helpers:108:19) at requireResolveNonCached (/Users/_/nodemodules/ts-node/dist/bin.js:321:16) at getProjectSearchDir (/Users//node_modules/ts-node/dist/bin.js:291:40) at main (/Users/zam/node_modules/ts-node/dist/bin.js:193:27) at Object. (/Users/_/node_modules/ts-node/dist/bin.js:351:5) at Module._compile (node:internal/modules/cjs/loader:1097:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) { code: 'MODULE_NOT_FOUND', requireStack: [ '/Users/***/solana-mint/metaplex/js/packages/cli/src/imaginaryUncacheableRequireResolveScript'

how did you pass this ?

Stitches101 commented 2 years ago

I just had the same issue. Solved it by doing cd metaplex/js/packages/cli/src and running ts-node ./candy-machine-cli.ts upload ./assets --env devnet -k <keypair-path> You should have both assets folder and candy-machine-cli.ts in same directory, i.e in the metaplex/js/packages/cli/src directory

This worked for me

This worked for me to, go in folder en got an update request for npx also: in my folder was only the candy machine v1 and v2 available so my command was: npx ts-node candy-machine-v1-cli.ts -h

Darkwollbtw commented 2 years ago

Ho lo stesso problema! @ArguableExorcist8 ArguableExorcist8 hai trovato una soluzione? have you found the solution?

ghost commented 2 years ago

Hi! same error here , has anyone found the solution?

niranjan3574 commented 2 years ago

same here bro

niranjan3574 commented 2 years ago

i didnt understand what you want to say ??


**C:\Users\Beast\Desktop\84229\metaplex\js> cd metaplex/js/packages/cli/src and running ts-node ./candy-machine-cli.ts upload ./assets --env devnet -k At line:1 char:108

stegaBOB commented 2 years ago

everyone, that file doesnt exist anymore. Please get the latest version of metaplex (pull from the master branch)

qamtrading commented 2 years ago

El problema al parecer está en ts-node.

qamtrading commented 2 years ago

AL PARECER ENCONTRÉ LA SOLUCION, EL GRAN PROBLEMA ESTÁ EN LA VERSION DE NODE.

solana acepta la version de salida: v16.14.2

Entonces cómo lo hice, fui a este link: https://github.com/coreybutler/nvm-windows

Luego, fui a power shell o a CMD y lo abrí como administrador. (Me parece mejor ir a powershell) Luego puse nvm list 1 Ahí me di cuenta de la version de node que estaba usando, ya que aparece un asterisco al lado. Luego entonces puse este comando: 2 Esto para saber qué versiones estaban disponibles. Luego puse este comando para instalar la version que solana acepta de momento. nvm install 16.14.2 [64-bit] Se demora un poco, y cuando ya la había descargado, entonces puse este comando nvm use 16.14.2 [64-bit] Para que use esa version que es la que solana acepta. Finalmente para verificar que todo estaba funcionando normal puse este comando en visual studio code ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts --version Y entonces me apareció esto. 3

Pueden seguirme en instagram como @cami.trading jajaja