I'm fairly new to nuxt, currently developing my first site with it, and I've run into an error I can't quite figure out. My WSL Ubuntu dev environment was working just fine until I accidentally ran npm run build instead of npm run dev. Now, every time I try to run dev, I get the following:
> nuxt
FATAL Unexpected token export 15:54:51
export default {
^^^^^^
SyntaxError: Unexpected token export
at Object.compileFunction (vm.js:406:10)
at Generator.next (<anonymous>)
╭──────────────────────────────────────────╮
│ │
│ ✖ Nuxt Fatal Error │
│ │
│ SyntaxError: Unexpected token export │
│ │
╰──────────────────────────────────────────╯
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dogabel@1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dogabel@1.0.0 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! /home/hughbom/.npm/_logs/2020-07-21T13_54_51_067Z-debug.log
Here is the error log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/local/bin/npm', 'run', 'dev' ]
2 info using npm@6.14.6
3 info using node@v10.19.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle dogabel@1.0.0~predev: dogabel@1.0.0
6 info lifecycle dogabel@1.0.0~dev: dogabel@1.0.0
7 verbose lifecycle dogabel@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle dogabel@1.0.0~dev: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/hughbom/dogabel/node_modules/.bin:/home/hughbom/.vscode-server/bin/17299e413d5590b14ab0340ea477cdd86ff13daf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Python38/Scripts/:/mnt/c/Python38/:/mnt/d/Programs/bin:/mnt/d/Programs/libnvvp:/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/mnt/c/Program Files (x86)/Razer Chroma SDK/bin:/mnt/c/Program Files/Razer Chroma SDK/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Users/brad drac/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files (x86)/Calibre2/:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2019.4.0/:/mnt/c/Users/brad drac/Documents/opencv/build/x64/vc14/bin:/mnt/c/Program Files/nodejs/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Git/cmd:/mnt/c/Users/brad drac/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/brad drac/AppData/Roaming/npm:/snap/bin
9 verbose lifecycle dogabel@1.0.0~dev: CWD: /home/hughbom/dogabel
10 silly lifecycle dogabel@1.0.0~dev: Args: [ '-c', 'nuxt' ]
11 silly lifecycle dogabel@1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle dogabel@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: dogabel@1.0.0 dev: `nuxt`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid dogabel@1.0.0
15 verbose cwd /home/hughbom/dogabel
16 verbose Linux 4.19.104-microsoft-standard
17 verbose argv "/usr/bin/node" "/usr/local/bin/npm" "run" "dev"
18 verbose node v10.19.0
19 verbose npm v6.14.6
20 error code ELIFECYCLE
21 error errno 1
22 error dogabel@1.0.0 dev: `nuxt`
22 error Exit status 1
23 error Failed at the dogabel@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
And here is my nuxt.config.js
export default {
/* Show nuxt debug logs */
dev: (process.env.DEBUG = 'nuxt:*'),
/*
** Nuxt rendering mode
** See https://nuxtjs.org/api/configuration-mode
*/
mode: 'universal',
/*
** Nuxt target
** See https://nuxtjs.org/api/configuration-target
*/
target: 'static',
/*
** Headers of the page
** See https://nuxtjs.org/api/configuration-head
*/
head: {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: process.env.npm_package_description || '',
},
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
},
/*
** Global CSS
*/
css: [
{ src: '@/css/main.scss', lang: 'scss' },
{ src: 'font-awesome/scss/font-awesome.scss', lang: 'scss' }
],
/*
** Plugins to load before mounting the App
** https://nuxtjs.org/guide/plugins
*/
plugins: [],
/*
** Auto import components
** See https://nuxtjs.org/api/configuration-components
*/
components: true,
/*
** Nuxt.js dev-modules
*/
buildModules: ['@nuxt/typescript-build', 'nuxt-purgecss'],
/*
** Nuxt.js modules
*/
modules: [
// Doc: https://github.com/nuxt/content
'@nuxt/content',
],
/*
** Content module configuration
** See https://content.nuxtjs.org/configuration
*/
content: {},
/*
** Build configuration
** See https://nuxtjs.org/api/configuration-build/
*/
build: {},
}
I have no idea what the problem is from the error message and logs(perhaps I need to transpile something?), so any help would be appreciated.