question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Nuxt SyntaxError: Unexpected token 'export' - nuxtjs 2.15.0 - tailwindcss

See original GitHub issue

Hi, I upgraded nuxt from 2.14.12 to 2.15.0, When Iโ€™m running in development mode with npm run dev command, Error happens!

When I remove '@nuxtjs/tailwindcss', Error not happens.

Nuxt.config.js:

buildModules: [
  '@nuxtjs/tailwindcss',
],

Error:

ฮป npm run dev                                                                                                           
                                                                                                                        
> client@0.45.5 dev D:\projects\iranuiux.ir\client                                                                      
> nuxt                                                                                                                  
                                                                                                                        
                                                                                                                        
 FATAL  Unexpected token 'export'                                                                             23:24:42  
                                                                                                                        
  (function (exports, require, module, __filename, __dirname) { export default {                                        
  ^^^^^^                                                                                                                
                                                                                                                        
  SyntaxError: Unexpected token 'export'                                                                                
  at new Script (vm.js:101:7)                                                                                           
  at p._moduleCompile (node_modules\jiti\dist\v8cache.js:2:3046)                                                        
  at Module.o._compile (node_modules\jiti\dist\v8cache.js:2:2597)                                                       
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)                                             
  at Module.load (internal/modules/cjs/loader.js:928:32)                                                                
  at Function.Module._load (internal/modules/cjs/loader.js:769:14)                                                      
  at Module.require (internal/modules/cjs/loader.js:952:19)                                                             
  at n (node_modules\jiti\dist\v8cache.js:2:2364)                                                                       
  at ModuleContainer.module.exports (node_modules\@nuxtjs\tailwindcss\lib\module.js:36:22)                              
  at async ModuleContainer.addModule (node_modules\@nuxt\core\dist\core.js:239:20)                                      
                                                                                                                        
                                                                                                                        
   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ                                                                       
   โ”‚                                            โ”‚                                                                       
   โ”‚   โœ– Nuxt Fatal Error                       โ”‚                                                                       
   โ”‚                                            โ”‚                                                                       
   โ”‚   SyntaxError: Unexpected token 'export'   โ”‚                                                                       
   โ”‚                                            โ”‚                                                                       
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ                                                                       
                                                                                                                        
npm ERR! code ELIFECYCLE                                                                                                
npm ERR! errno 1                                                                                                        
npm ERR! client@0.45.5 dev: `nuxt`                                                                                      
npm ERR! Exit status 1                                                                                                  
npm ERR!                                                                                                                
npm ERR! Failed at the client@0.45.5 dev script.                                                                        
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.                      

Everything works awesome in nuxt 2.14.12, in nuxt 2.15.0 this error happens.

Dependencies

"dependencies": {
    "@nuxtjs/axios": "^5.13.1",
    "@nuxtjs/google-analytics": "^2.4.0",
    "@nuxtjs/recaptcha": "^1.0.1",
    "core-js": "^3.9.0",
    "csrf": "^3.1.0",
    "jalali-moment": "^3.3.9",
    "lodash": "^4.17.20",
    "nuxt": "^2.15.0",
    "nuxt-buefy": "^0.4.4",
    "sass": "^1.32.7",
    "sass-loader": "^10.1.0",
    "v-clipboard": "^2.2.3",
    "vee-validate": "^3.4.5"
  },
  "devDependencies": {
    "@nuxt/types": "^2.15.0",
    "@nuxtjs/tailwindcss": "^3.4.2",
    "@vue/test-utils": "^1.1.3",
    "autoprefixer": "^9.8.6",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^26.5.0",
    "eslint": "^7.20.0",
    "eslint-config-airbnb-base": "^14.2.1",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-vue": "^7.6.0",
    "jest": "^26.5.0",
    "postcss": "^7.0.35",
    "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.3",
    "vue": "^2.6.12",
    "vue-jest": "^3.0.4"
  }

Versions

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

2reactions
stale[bot]commented, Aug 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

2reactions
DiegoRodriguezTandilcommented, Apr 18, 2021

nuxt build

FATAL Unexpected token โ€˜exportโ€™ 16:06:26

(function (exports, require, module, __filename, __dirname) { export const future = { ^^^^^^

SyntaxError: Unexpected token โ€˜exportโ€™ at new Script (node:vm:101:7) at p._moduleCompile (node_modules/jiti/dist/v8cache.js:2:3154) at Module.o._compile (node_modules/jiti/dist/v8cache.js:2:2705) at Object.Module._extensionsโ€ฆjs (node:internal/modules/cjs/loader:1137:10) at Module.load (node:internal/modules/cjs/loader:973:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Module.require (node:internal/modules/cjs/loader:997:19) at n (node_modules/jiti/dist/v8cache.js:2:2472) at ModuleContainer.module.exports (node_modules/@nuxtjs/tailwindcss/lib/module.js:33:22) at async ModuleContainer.addModule (node_modules/@nuxt/core/dist/core.js:239:20)

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚ โ”‚ โ”‚ โœ– Nuxt Fatal Error โ”‚ โ”‚ โ”‚ โ”‚ SyntaxError: Unexpected token โ€˜exportโ€™ โ”‚ โ”‚ โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Any idea of this error?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt SyntaxError: Unexpected token 'export' - nuxtjs 2.15.0
Hi, I upgraded nuxt from 2.14.12 to 2.15.0, When I'm running in development mode with npm run dev command, Error happens!
Read more >
nuxt error "Uncaught SyntaxError: Unexpected token '<'" when ...
I finally found a solution, it's actually the rewrite rules in the vhost that don't work properly. By creating a .htaccess directly at...
Read more >
How to fix Nuxt.js unexpected token export error - YouTube
Setting up Nuxt.js is a pretty straightforward process but I hit at least one snag. Here's how I got around an issue I...
Read more >
Angular2 Final Release - "Error: Angular requires Zone.js ...
Issue. I have upgraded from RC4 to the Final release of Angular2. When I run npm start , the app is stuck on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found