原创

TypeError: Cannot read property 'range' of null

ERROR  Failed to compile with 1 errors                              14:19:12

 error  in ./src/router/home-router.js

Module build failed (from ./node_modules/_eslint-loader@2.2.1@eslint-loader/index.js):
TypeError: Cannot read property 'range' of null
Occurred while linting /Users/zhouyajun/workspace/imooc/sparrow/src/router/home-router.js:25
    at SourceCode.getTokenBefore (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/source-code/token-store/index.js:298:18)
    at checkSpacingBefore (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/rules/template-curly-spacing.js:60:42)
    at TemplateElement (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/rules/template-curly-spacing.js:119:17)
    at listeners.(anonymous function).forEach.listener (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/code-path-analysis/code-path-analyzer.js:634:23)
    at nodeQueue.forEach.traversalInfo (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/linter.js:936:32)
    at Array.forEach (<anonymous>)
    at runRules (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/linter.js:931:15)
    at Linter._verifyWithoutProcessors (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/linter.js:1157:31)
    at Linter._verifyWithConfigArray (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/linter.js:1255:21)
    at Linter.verify (/Users/zhouyajun/workspace/imooc/sparrow/node_modules/_eslint@6.8.0@eslint/lib/linter/linter.js:1210:25)

 @ ./src/router/route.js 13:0-39 21:31-41
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi ./node_modules/_webpack-dev-server@3.11.0@webpack-dev-server/client?http://192.168.1.107:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

解决:
.eslintrc.js文件里,rules修改或者新增下面的配置

"template-curly-spacing" : "off",
    indent : "off",
正文到此结束
该篇文章的评论功能已被站长关闭
本文目录