onflow / kitty-items

Kitty Items: CryptoKitties Sample App
https://kitty-items.onflow.org
Apache License 2.0
408 stars 213 forks source link

Unknown file extension ".CMD" #241

Closed IvanAnikin closed 2 years ago

IvanAnikin commented 2 years ago

I’m running into this issue when running “npm run dev:emulator” in main directory of the https://github.com/onflow/kitty-items repository after running ‘npm install’:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".CMD" for C:\USERS\30407792\CODE\FLOW\2\KITTY-ITEMS\NODE_MODULES.BIN\NPM.CMD 2|web | at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:71:15) 2|web | at Loader.getFormat (internal/modules/esm/loader.js:104:42) 2|web | at Loader.getModuleJob (internal/modules/esm/loader.js:242:31) 2|web | at async Loader.import (internal/modules/esm/loader.js:176:17) { 2|web | code: 'ERR_UNKNOWN_FILE_EXTENSION'

Thanks in advance

muttoni commented 2 years ago

Hi, it may be a node/npm installation issue but hard to debug from here. Can you give more details about your current setup? Please run npx envinfo and paste the output here.

IvanAnikin commented 2 years ago

Hey,

there you go

System: OS: Windows 10 10.0.19044 CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz Memory: 1.48 GB / 7.82 GB Binaries: Node: 16.14.2 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.18 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.5.5 - ~\code\flow\kitty-items\node_modules.bin\npm.CMD Managers: Composer: 2.0.13 - C:\ProgramData\ComposerSetup\bin\composer.BAT pip3: 22.0.4 - C:\Python310\Scripts\pip3.EXE Utilities: Git: 2.24.1. Virtualization: Docker: 20.10.6 - C:\Program Files\Docker\Docker\resources\bin\docker.EXE IDEs: VSCode: 1.65.2 - C:\Program Files\Microsoft VS Code\bin\code.CMD Languages: PHP: 7.4.18 - C:\xampp\php\php.EXE Python: 3.10.4 Python3: 3.9.12 Databases: SQLite: 3.36.0 - C:\ProgramData\Anaconda3\Library\bin\sqlite3.EXE Browsers: Edge: Spartan (44.19041.1266.0), Chromium (99.0.1150.55) Internet Explorer: 11.0.19041.1566 Monorepos: Lerna: 4.0.0

Thanks, I tried installing the packages separetely in different folders with npm install and yarn install and running it with the yarn or npm in each directory, but the error was always the same.

brunogonzales commented 2 years ago

I'm experiencing this same error on a Windows laptop after executing npm run dev:testnet and pasting the faucet address.

The program prints the Kitty Items has started in multicolor and then it crashes printing these logs:

C:\Users\vr1.pm2\pm2.log last 15 lines: PM2 | 2022-04-20T11:18:01: PM2 log: App [api:0] online PM2 | 2022-04-20T11:18:01: PM2 log: App [web:1] online PM2 | 2022-04-20T11:18:02: PM2 log: App [api:0] exited with code [0] via signal [SIGINT] PM2 | 2022-04-20T11:18:02: PM2 log: App [api:0] starting in -fork mode- PM2 | 2022-04-20T11:18:02: PM2 log: App [web:1] exited with code [0] via signal [SIGINT] PM2 | 2022-04-20T11:18:03: PM2 error: Cancelling versioning data parsing PM2 | 2022-04-20T11:18:05: PM2 log: App [api:0] online PM2 | 2022-04-20T11:18:05: PM2 log: App [api:0] exited with code [0] via signal [SIGINT] PM2 | 2022-04-20T11:18:05: PM2 log: App [api:0] starting in -fork mode- PM2 | 2022-04-20T11:18:08: PM2 log: App [api:0] online PM2 | 2022-04-20T11:18:09: PM2 log: App [api:0] exited with code [0] via signal [SIGINT] ... 1|web | code: 'ERR_UNKNOWN_FILE_EXTENSION' 1|web | } 1|web | TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".CMD" for C:\USERS\VR1\GITHUB\KITTY-ITEMS.GIT\NODE_MN\NPM.CMD 1|web | at new NodeError (node:internal/errors:371:5) 1|web | at Object.getFileProtocolModuleFormat as file: 1|web | at defaultGetFormat (node:internal/modules/esm/get_format:102:38) 1|web | at defaultLoad (node:internal/modules/esm/load:21:14) 1|web | at ESMLoader.load (node:internal/modules/esm/loader:359:26) 1|web | at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58) 1|web | at new ModuleJob (node:internal/modules/esm/module_job:66:26) 1|web | at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17) 1|web | at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34) 1|web | at processTicksAndRejections (node:internal/process/task_queues:96:5) { 1|web | code: 'ERR_UNKNOWN_FILE_EXTENSION' 1|web | } .... 0|api | TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".CMD" for C:\USERS\VR1\GITHUB\KITTY-ITEMS.GIT\NODE_MN\NPM.CMD 0|api | at new NodeError (node:internal/errors:371:5) 0|api | at Object.getFileProtocolModuleFormat as file: 0|api | at defaultGetFormat (node:internal/modules/esm/get_format:102:38) 0|api | at defaultLoad (node:internal/modules/esm/load:21:14) 0|api | at ESMLoader.load (node:internal/modules/esm/loader:359:26) 0|api | at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58) 0|api | at new ModuleJob (node:internal/modules/esm/module_job:66:26) 0|api | at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17) 0|api | at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34) 0|api | at processTicksAndRejections (node:internal/process/task_queues:96:5) { 0|api | code: 'ERR_UNKNOWN_FILE_EXTENSION' 0|api | }

envinfo System: OS: Windows 10 10.0.19042 CPU: (12) x64 AMD Ryzen 5 5500U with Radeon Graphics Memory: 2.81 GB / 9.86 GB Binaries: Node: 16.14.2 - C:\Program Files\nodejs\node.EXE npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD Managers: pip3: 22.0.4 - C:\Python310\Scripts\pip3.EXE Utilities: Git: 2.35.1. - /mingw64/bin/git IDEs: VSCode: 1.66.2 - C:\Users\holab\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD Languages: Bash: 4.4.23 - C:\Program Files\Git\usr\bin\bash.EXE Perl: 5.34.0 - C:\Program Files\Git\usr\bin\perl.EXE Python: 3.10.3 - /c/Python310/python Browsers: Edge: Spartan (44.19041.1266.0), Chromium (100.0.1185.44) Internet Explorer: 11.0.19041.1566

jdietzChina commented 2 years ago

I'm getting the same issues... anyone find the answer? Maybe port issues?

sonerakinci commented 2 years ago

OMG. There is no answer for this critic error. I took same error but there is no solution for 2 months.

bluesign commented 2 years ago

As a workaround , you can launch api and web manually. ( after contract is deployed )

For Testnet:

For Emulator

AttackOnSight commented 2 years ago

As a workaround , you can launch api and web manually. ( after contract is deployed )

For Testnet:

  • npx dotenv-cli -e .env.testnet – npm run dev --prefix api
  • npx dotenv-cli -e .env.testnet – npm run dev --prefix web

For Emulator

  • npx dotenv-cli -e .env.emulator – npm run dev --prefix api
  • npx dotenv-cli -e .env.emulator – npm run dev --prefix web

I'm getting the following error when trying to input the above commands.

npm ERR! arg Argument starts with non-ascii dash, this is probably invalid: –
'–' is not recognized as an internal or external command,
operable program or batch file.

I've typed it in manually as well, which still gives an error. Has anyone had success with this?

bluesign commented 2 years ago

@AttackOnSight updated the comment, double dash merged somehow, can you try again?

AttackOnSight commented 2 years ago

@bluesign Thank you for the help. Everything seems to work fine for this issue now with the updated commands.

Just a tip for anyone else who might come across this later issue, it seems like the Opera Crypto Browser is having some trouble when minting as an Admin (it just loops without creating the NFT), but switching to Firefox solved that issue.

AttackOnSight commented 2 years ago

@bluesign sorry for the reping, hopefully you can help me with this error when trying to launch the API for emulator, I am getting this error on the console.

Error: Response closed without headers
    at Object.onEnd (C:\Users\****\Repos\kitty-items\api\node_modules\@onflow\transport-grpc\src\unary.js:19:18)
    at C:\Users\****\Repos\kitty-items\api\node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.js:1:24233
    at C:\Users\****\Repos\kitty-items\api\node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.js:1:11490
    at Array.forEach (<anonymous>)
    at e.rawOnError (C:\Users\****\Repos\kitty-items\api\node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.js:1:11452)
    at e.onTransportEnd (C:\Users\****\Repos\kitty-items\api\node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.js:1:10318)
    at ClientRequest.<anonymous> (C:\Users\****\Repos\kitty-items\api\node_modules\@improbable-eng\grpc-web-node-http-transport\src\index.ts:70:20)
    at ClientRequest.emit (node:events:520:28)
    at Socket.socketErrorListener (node:_http_client:442:9)
    at Socket.emit (node:events:520:28)
[ERROR] 13:42:07 Error: Response closed without headers

The error is displayed on localhost:3001 as:

Unhandled Runtime Error
Error: Response closed without headers

Call Stack
Object.onEnd
node_modules\@onflow\transport-grpc\dist\sdk-send-grpc.module.js (1:1164)
eval
node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.umd.js (1:24350)
eval
node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.umd.js (1:11609)
Array.forEach
<anonymous>
e.rawOnError
node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.umd.js (1:11441)
e.onTransportEnd
node_modules\@improbable-eng\grpc-web\dist\grpc-web-client.umd.js (1:10387)
e.exports.eval
node_modules\@improbable-eng\grpc-web-node-http-transport\lib\index.js (64:0)
e.exports.emit
node_modules\next\dist\compiled\events\events.js (1:2420)
eval
node_modules\next\dist\compiled\stream-http\index.js (1:6848)
dajuguan commented 2 years ago

That is because pm2 can not recognize the 'npm.cmd' command, referring to here. An easy solution is to change the two npm in .ki-scripts\startup.js to , like this: await runProcess({ name:web, cwd: "./web", script:C:\Program\ Files\nodejs\node_modules\npm\bin\npm-cli.js, args: "run dev", watch: false, wait_ready: true, autorestart: false });

MrDSGC commented 2 years ago

Issue should be resolved here #268