wechaty / getting-started

A Starter Project Template for Wechaty works out-of-the-box
https://gitpod.io/#https://github.com/wechaty/wechaty-getting-started
Apache License 2.0
797 stars 351 forks source link

SyntaxError: Unexpected token '.' #204

Open huan opened 3 years ago

huan commented 3 years ago

TL;DR: Update Node.js to version 16+

If you saw the following error messages:

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)

Then please check the version of your Node.js:

node --version

If the version is below 14, then you need to upgrade Node.js to version 14 or above (16 is recommended).

Wechaty requires Node.js 14+ since version 0.69

holylander commented 2 years ago

thanks mate! this was really helpful for me :9

huan commented 2 years ago

You are welcome!

OmerAtayilmaz commented 1 year ago

Thanks :)

kasm commented 1 year ago

What if I already have Node version 16.15.0 but this error still exists?

Zadag commented 1 year ago

@kasm Did you find a solution?

mrpatrickwest commented 1 year ago

Has anyone found a solution for this? I'm running node 16.13.0 and still getting these errors.

manusharmaappfoster commented 12 months ago

I am using v14.21.3 and facing same issue

Zadag commented 12 months ago

@manusharmaappfoster The easiest fix is updating to 16+

Parnia-mohammadi commented 5 months ago

I have the same problem,I want to use vs code in windows 7 so i should use node.js version 13.14.0. now when i want to use vite for creating app, it send this error to me. what can i do now? SyntaxError: Unexpected token '.' ←[90m at Loader.moduleStrategy (internal/modules/esm/translators.js:81:18)←[39m

Mhdnoor06 commented 4 months ago

Did any of you find the solution, i tried upgrading to different versions like 16, 18, 20 the error message is same for all.

node:20596) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token '??=' at Loader.moduleStrategy (internal/modules/esm/translators.js:145:18) (Use node --trace-warnings ... to show where the warning was created) (node:20596) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:20596) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

NIKPATEL-13 commented 2 months ago

@Mhdnoor06 type this command and check your node version. node -v

if you are using any latest lib make sure you upgrade your node version using nvm. you can install and keep multiple node version in your local system and use any of them using "nvm use <@node-version / @node-version-name / --lts>" command

example : nvm use --lts