thenorthsolution / Reciple

⚡Discord.js framework that just works
https://reciple.js.org
GNU General Public License v3.0
12 stars 1 forks source link

create-reciple setup bug with "no" option on ES Modules #40

Closed PAdventures closed 11 months ago

PAdventures commented 11 months ago

Running npm create-reciple@latest using the steps I followed below will cause an error

npm create reciple@latest
┌  create-reciple v8.2.0
│
◇  Enter project directory
│  /Users/NAME/Desktop/Personal/YaraBot/Yara
│
◇  Would you like to use typescript?
│  Yes
│
◇  Would you like to use ES Modules? (uses import() instead of require())
│  No
│
◇  Select a addons from Reciple (Press space to select, and enter to submit)
│  reciple-interaction-events, reciple-anticrash, reciple-dev-commands, reciple-registry-cache
│
◇  Select your preferred package manager
│  npm
│
└  Setup Done! Creating from Typescript - CommonJs template

This exact setup will result in the following error:

$ npx reciple@8.1.8 /Users/USER/Desktop/Personal/YaraBot/Yara --setup -c reciple.cjs
(node:96274) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/USER/Desktop/Personal/YaraBot/Yara/reciple.cjs:4
import { cliVersion } from 'reciple';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at cjsLoader (node:internal/modules/esm/translators:345:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)

Node.js v21.1.0
npm ERR! code 1
npm ERR! path /Users/USER/Desktop/Personal/YaraBot/Yara
npm ERR! command failed
npm ERR! command sh -c create-reciple

npm ERR! A complete log of this run can be found in: PATH/TO/LOG

Note: I am using MacOS sonoma v14.1.1, using VSCode and Warp as my terminal

My Node version is v21.1.0 and NPM version is v10.2.0