Module Error (from ./node_modules/eslint-loader/index.js):解决办法
<p>vue启动项目报如下错误:</p><div class="cnblogs_code">
<pre><span style="color: rgba(0, 0, 0, 1)">Failed to compile.
.</span>/src/components/<span style="color: rgba(0, 0, 0, 1)">Vcontent.vue
<span style="color: rgba(255, 0, 0, 1)">Module Error (</span></span><span style="color: rgba(255, 0, 0, 1)">from ./node_modules/eslint-loader/</span><span style="color: rgba(0, 0, 0, 1)"><span style="color: rgba(255, 0, 0, 1)">index.js):</span>
E:\myvue\src\components\Vcontent.vue
</span><span style="color: rgba(128, 0, 128, 1)">4</span>:<span style="color: rgba(128, 0, 128, 1)">15</span>errorParsing error: unexpected-character-<span style="color: rgba(0, 0, 255, 1)">in</span>-attribute-namevue/no-parsing-<span style="color: rgba(0, 0, 0, 1)">error
</span><span style="color: rgba(128, 0, 128, 1)">4</span>:<span style="color: rgba(128, 0, 128, 1)">37</span>errorParsing error: unexpected-character-<span style="color: rgba(0, 0, 255, 1)">in</span>-attribute-namevue/no-parsing-<span style="color: rgba(0, 0, 0, 1)">error
</span>? <span style="color: rgba(128, 0, 128, 1)">2</span> problems (<span style="color: rgba(128, 0, 128, 1)">2</span> errors, <span style="color: rgba(128, 0, 128, 1)">0</span> warnings)</pre>
</div>
<p>当vue渲染html为原生标签时出这个错误,需要修改配置项。</p>
<p>优化如下:</p>
<p>第一步:初始化并重新安装eslint</p>
<div class="cnblogs_code">
<pre>npm init -<span style="color: rgba(0, 0, 0, 1)">y
npm install eslint </span>--save-dev</pre>
</div>
<p>第二步:进入node_modules下的bin目录,并初始化eslint</p>
<div class="cnblogs_code">
<pre>cd ./node_modules/.bin/<span style="color: rgba(0, 0, 0, 1)">
eslint </span>--init</pre>
</div>
<p>第三步:设置配置选项,除选择vue.js外,其他都选择默认项或者y或者Y,如下仅仅到选择vue.js步骤</p>
<div class="cnblogs_code">
<pre>? How would you like to use ESLint?<span style="color: rgba(0, 0, 0, 1)"> To check syntax and find problems
</span>? What type of modules does your project use? JavaScript modules (import/<span style="color: rgba(0, 0, 0, 1)">export)
</span>? Which framework does your project use? Vue.js</pre>
</div>
<p>第四步:最重要的一步,将node_modules目录下的bin目录里面的.eslintrc.js文件拷贝到项目根目录下</p>
<p>第五步:启动服务,严重结果:</p>
<div class="cnblogs_code">
<pre>npm run serve</pre>
</div>
<p>结束!</p><br><br>
来源:https://www.cnblogs.com/aaronthon/p/12917679.html
頁:
[1]