Unexpected token '.' syntax error while using @nuxtjs/strapi module in nuxt.js

1k Views Asked by At

I'm trying to use @nuxtjs/strapi module in my Nuxt.js application. I've installed it with yarn command by using this command.

yarn add @nuxtjs/strapi

And I've changed the nuxt.config.js file

modules: [
  ...
  '@nuxtjs/strapi'
],
...
strapi: {
  url: process.env.STRAPI_URL || `http://localhost:1337/api`,
  entities: ['games'],
},

The thing is, I got this error just after change the nuxt.config.js file.

 FATAL  Unexpected token '.'                                                                                                                                                                   04:01:58

  at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)


   ╭───────────────────────────────────────╮
   │                                       │
   │   ✖ Nuxt Fatal Error                  │
   │                                       │
   │   SyntaxError: Unexpected token '.'   │
   │                                       │
   ╰───────────────────────────────────────╯

npm ERR! errno 1
npm ERR! [email protected] dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2022-03-22T19_01_58_618Z-debug.log

What is the best way to handle this issue?

PS: My nuxt version is 2.15.8 and @nuxtjs/strapi version is 1.3.1.

Npm version is 6.14.15 and Node version is 12.22.9.

Github link: https://github.com/Count-Monte/tower-of-hanoi

0

There are 0 best solutions below