npm run build 报错!Build failed with errors

npm run build 报错!Build failed with errors.

[root@VM_0_9_centos client]# npm run build

> [email protected] build /www/wwwroot/fenturuning/client
> vue-cli-service build


⠸  Building for production...


 ERROR  Failed to compile with 1 errors                          8:44:28 AM

 error  in ./src/router/index.js

Module build failed (from ./node_modules/[email protected]@thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
Cannot read property 'range' of null
    at PoolWorker.fromErrorObj (/www/wwwroot/fenturuning/client/node_modules/[email protected]@thread-loader/dist/WorkerPool.js:262:12)
    at /www/wwwroot/fenturuning/client/node_modules/[email protected]@thread-loader/dist/WorkerPool.js:204:29
    at SourceCode.getTokenBefore (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/token-store/index.js:303:18)
    at checkSpacingBefore (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/rules/template-curly-spacing.js:52:42)
    at TemplateElement (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/rules/template-curly-spacing.js:117:17)
    at /www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/util/safe-emitter.js:47:58
    at Array.forEach ()
    at Object.emit (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/www/wwwroot/fenturuning/client/node_modules/[email protected]@eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)

 @ ./src/main.js 35:0-30 38:12-18 44:10-16
 @ multi ./src/main.js

 ERROR  Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build 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!     /root/.npm/_logs/2020-01-03T00_44_28_399Z-debug.log

报错显示:./src/router/index.js 文件错误;
是在看不出哪里的错误;
求大神指点!!
下面是文档全部内容;

/**
 * Vue Router
 *
 * @library
 *
 * https://router.vuejs.org/en/
 */

// Lib imports
import Vue from 'vue'
import VueAnalytics from 'vue-analytics'
import Router from 'vue-router'
import Meta from 'vue-meta'

// Routes
import paths from './paths'

function route (path, view, name) {
  return {
    name: name || view,
    path,
    component: (resovle) => import(
      `@/views/${view}.vue`
    ).then(resovle),
  }
}

Vue.use(Router)

// Create a new router
const router = new Router({
  mode: 'history',
  routes: paths.map(path => route(path.path, path.view, path.name)).concat([
    { path: '*', redirect: '/dashboard' }
  ]),
  scrollBehavior (to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    }
    if (to.hash) {
      return { selector: to.hash }
    }
    return { x: 0, y: 0 }
  }
})

Vue.use(Meta)

// Bootstrap Analytics
// Set in .env
// https://github.com/MatteoGabriele/vue-analytics
if (process.env.GOOGLE_ANALYTICS) {
  Vue.use(VueAnalytics, {
    id: process.env.GOOGLE_ANALYTICS,
    router,
    autoTracking: {
      page: process.env.NODE_ENV !== 'development'
    }
  })
}

export default router

求解决,好几天了!!

你可能感兴趣的:(npm run build 报错!Build failed with errors)