Error
Samir-OP opened this issue · 7 comments
import Client from "./structures/client";
^^^^^^
SyntaxError: Cannot use import statement outside a module
Did you transpile the source code using tsc
before running node
?
How?
Read the README. It tells you how to set this project up. You need a "transpiler" (tsc) that turns TypeScript code into JavaScript code.
Run npm i -g typescript
to install tsc, then run tsc
to actually transpile it.
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/typescript/bin/tsc
npm ERR! dest /usr/bin/tsc
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/typescript/bin/tsc' -> '/usr/bin/tsc'
npm ERR! File exists: /usr/bin/tsc
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-09-22T13_27_37_116Z-debug.log
root@dynamokavps:~/discordcaptcha# npm start
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-09-22T13_27_52_755Z-debug.log```
npm ERR! File exists: /usr/bin/tsc
Sounds like you already have it installed (?) Can you send me the output of tsc -v
? If that doesn't work, try running it without the -g
flag to keep it in node_modules and use the path to the binary, e.g.
npm i typescript
./node_modules/typescript/bin/tsc
(node:66770) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/root/discordcaptcha/src/run.ts:1
import Client from "./structures/client";
^^^^^^
SyntaxError: Cannot use import statement outside a module
How did you run node
? To me it looks like you tried to do something like node src/run.ts
, which obviously doesn't work because Node.js/v8 doesn't know TypeScript. Just run it as node .
after transpiling the source code.
DM me on Discord (y21#0909) and I'll help you there. Some people get a notification for every issue and comment on this repo and I don't want people to get 100 mails for unrelated conversations..