metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!

Home Page:https://metaplex.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TSError: ⨯ Unable to compile TypeScript: ~/deprecated-clis/src/candy-machine-v2-cli.ts

gambitboxdev opened this issue · comments

When executing

ts-node ~/deprecated-clis/src/candy-machine-v2-cli.ts upload -e mainnet-beta -k ~/.config/solana/mainnet-beta.json -cp config.json -c example ./assets

I have been receiving this.

`C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:750
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
~/deprecated-clis/src/candy-machine-v2-cli.ts:4:47 - error TS2307: Cannot find module 'commander' or its corresponding type declarations.

4 import { InvalidArgumentError, program } from 'commander';
~~~~~~~~~~~
~/deprecated-clis/src/candy-machine-v2-cli.ts:5:25 - error TS2307: Cannot find module '@project-serum/anchor' or its corresponding type declarations.

5 import * as anchor from '@project-serum/anchor';
~~~~~~~~~~~~~~~~~~~~~~~
~/deprecated-clis/src/candy-machine-v2-cli.ts:14:45 - error TS2307: Cannot find module '@solana/web3.js' or its corresponding type declarations.

14 import { PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';
~~~~~~~~~~~~~~~~~
~/deprecated-clis/src/candy-machine-v2-cli.ts:42:17 - error TS2307: Cannot find module 'loglevel' or its corresponding type declarations.

42 import log from 'loglevel';
~~~~~~~~~~
~/deprecated-clis/src/candy-machine-v2-cli.ts:46:25 - error TS2307: Cannot find module 'mime' or its corresponding type declarations.

46 import { getType } from 'mime';
~~~~~~
~/deprecated-clis/src/candy-machine-v2-cli.ts:51:22 - error TS2307: Cannot find module '@project-serum/anchor/dist/cjs/utils/bytes' or its corresponding type declarations.

51 import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

at createTSError (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:750:12)
at reportTSError (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:754:19)
at getOutput (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:941:36)
at Object.compile (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1243:30)
at Module.m._compile (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (C:\Users\admin\AppData\Roaming\npm\node_modules\ts-node\src\index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {

diagnosticText: "\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m4\x1B[0m:\x1B[93m47\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module 'commander' or its corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m4\x1B[0m import { InvalidArgumentError, program } from 'commander';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~\x1B[0m\r\n' +
"\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m5\x1B[0m:\x1B[93m25\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@project-serum/anchor' or its
corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m5\x1B[0m import * as anchor from '@project-serum/anchor';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~~~~~~~\x1B[0m\r\n' +
"\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m14\x1B[0m:\x1B[93m45\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@solana/web3.js' or its corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m14\x1B[0m import { PublicKey, LAMPORTS_PER_SOL } from '@solana/web3.js';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~\x1B[0m\r\n' +
"\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m42\x1B[0m:\x1B[93m17\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module 'loglevel' or its corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m42\x1B[0m import log from 'loglevel';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~\x1B[0m\r\n' +
"\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m46\x1B[0m:\x1B[93m25\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module 'mime' or its corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m46\x1B[0m import { getType } from 'mime';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~\x1B[0m\r\n' +
"\x1B[96m~/deprecated-clis/src/candy-machine-v2-cli.ts\x1B[0m:\x1B[93m51\x1B[0m:\x1B[93m22\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2307: \x1B[0mCannot find module '@project-serum/anchor/dist/cjs/utils/bytes' or its corresponding type declarations.\r\n" +
'\r\n' +
"\x1B[7m51\x1B[0m import { bs58 } from '@project-serum/anchor/dist/cjs/utils/bytes';\r\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\x1B[0m\r\n',
diagnosticCodes: [ 2307, 2307, 2307, 2307, 2307, 2307 ]
}`

commented

Cannot find commander, @project-serum/anchor, '@solana/web3.js and etc.

Try re-installing modules that are missing.

One of the example:
yarn add @project-serum/anchor

Thanks! I tried to re-install the modules, but it seems like it keeps getting an error with this one now even after trying to reinstalling @solana/spl-token and @metaplex-foundation/mpl-token-metadata

`TSError: ⨯ Unable to compile TypeScript:
~/deprecated-clis/src/helpers/various.ts:11:10 - error TS2305: Module '"@solana/spl-token"' has no exported member 'Token'.

11 import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
~~~~~
~/deprecated-clis/src/helpers/various.ts:20:3 - error TS2305: Module '"@metaplex-foundation/mpl-token-metadata"' has no exported member 'MetadataKey'.

20 MetadataKey,
~~~~~~~~~~~
~/deprecated-clis/src/helpers/various.ts:413:16 - error TS2693: 'Uses' only refers to a type, but is being used as a value here.

413 return new Uses({ useMethod: realUseMethod, total, remaining: total });
~~~~
~/deprecated-clis/src/helpers/various.ts:441:37 - error TS2339: Property 'findByMint' does not exist on type 'typeof Metadata'.

441 const metadata = await Metadata.findByMint(
~~~~~~~~~~
~/deprecated-clis/src/helpers/various.ts:450:36 - error TS2339: Property 'getEdition' does not exist on type 'typeof Metadata'.

450 const edition = await Metadata.getEdition(connection, collectionMintPubkey);
~~~~~~~~~~`

commented

Hi, I see that you have { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';

It wrote it is @solana/spl-token has no exported member 'Token', it has been depreciated. Please check the spl-token documentation for their new update.

I think mostly are depreciated issue. Just update a new one and it will be fine.