我发现vue-cli(2.9.6,但3.0.0 beta*有相同的问题)的构建过程需要一旦模板的html相对深入.
例如,我刚添加了一些预先包含的divs App.vue:
<template>
<div id="app">
<img src="./assets/logo.png">
<div><div><div><div></div></div></div></div>
<HelloWorld/>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
这花了很长时间.
但一旦得到这个:
<template>
<div id="app">
<img src="./assets/logo.png">
<div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
<HelloWorld/>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
然后建筑过程需要永远,我相信这个深度的巢并不是那么罕见.
我该如何处理这个问题?
似乎问题可能是特定于环境的,所以这里有详细信息.
至少可以使用这些环境重现此问题:
和节点和npm版本是:
node --version
# prints
v8.9.4
# and
npm version
# prints
{ npm: '6.1.0',
ares: '1.10.1-DEV',
cldr: '31.0.1',
http_parser: '2.7.0',
icu: '59.1',
modules: '57',
nghttp2: '1.25.0',
node: '8.9.4',
openssl: '1.0.2n',
tz: '2017b',
unicode: '9.0',
uv: '1.15.0',
v8: '6.1.534.50',
zlib: '1.2.11' …Run Code Online (Sandbox Code Playgroud) Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (/home/nayan/dd_pwa/node_modules/prettier/index.js:7051:13)
at formatWithCursor (/home/nayan/dd_pwa/node_modules/prettier/index.js:10370:12)
at /home/nayan/dd_pwa/node_modules/prettier/index.js:31115:15
at Object.format (/home/nayan/dd_pwa/node_modules/prettier/index.js:31134:12)
at Object.module.exports (/home/nayan/dd_pwa/node_modules/vue-loader/lib/template-compiler/index.js:80:23)
@ ./layouts/error.vue 7:0-368
@ ./.nuxt/index.js
@ ./.nuxt/client.js
@ multi webpack-hot-middleware/client?name=client&reload=true&timeout=30000&path=/__webpack_hmr ./.nuxt/client.js
Run Code Online (Sandbox Code Playgroud)
我在Nuxtjs上遇到了同样的问题.任何面临同样问题的人 救命?!!版本:"nuxt":"^ 1.0.0","更漂亮":"^ 1.12.1"
尝试了降级和升级更漂亮版本的所有选项.
在尝试使用构建新的webpack项目时,我反复收到错误vue-cli.我正在关注最新版本(3.0.0-beta.11)上的文档,也尝试使用早期版本,而不是测试版.
当我运行yarn serve它时尝试启动开发服务器并构建项目但在此处失败:
error in ./src/App.vue?vue&type=template&id=7ba5bd90
Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (/Users/cory/Code/chickadee/my-project/node_modules/prettier/index.js:7051:13)
at formatWithCursor (/Users/cory/Code/chickadee/my-project/node_modules/prettier/index.js:10370:12)
at /Users/cory/Code/chickadee/my-project/node_modules/prettier/index.js:31115:15
at Object.format (/Users/cory/Code/chickadee/my-project/node_modules/prettier/index.js:31134:12)
at actuallyCompile (/Users/cory/Code/chickadee/my-project/node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:93:29)
at compileTemplate (/Users/cory/Code/chickadee/my-project/node_modules/@vue/component-compiler-utils/dist/compileTemplate.js:26:16)
at Object.module.exports (/Users/cory/Code/chickadee/my-project/node_modules/vue-loader/lib/loaders/templateLoader.js:42:20)
@ ./src/App.vue?vue&type=template&id=7ba5bd90 1:0-194 1:0-194
@ ./src/App.vue
@ ./src/main.js
@ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.js
Run Code Online (Sandbox Code Playgroud)
yarnvue-cli生成新项目.项目生成并安装模块.prettier模块,但似乎仍然出现错误.还有什么可以尝试通过此错误?