Comments (69)
as a workaround, in your package.json, force prettier to be 1.12 with
npm install prettier@~1.12.1 .
UPDATE: NO need to do downgrade prettier version now, this was working as workaround before release of @vue/component-compiler-utils 1.3.1
If you have applied downgrade above, remove it from pacakge.json then run
npm update --depth=9999 @vue/component-compiler-utils
if havn't just run
npm update --depth=9999 @vue/component-compiler-utils
from component-compiler-utils.
Released in 1.3.1
from component-compiler-utils.
remove node_modules
and reinstall everything.
from component-compiler-utils.
@lanxin1234 no need install prettier-1.12.x.
use npm replace cnpm, or wait taobao update component-compiler-utils-1.3.0 to 1.3.1
此问题尤大已经解决,无需降级prettier。删掉node_modules,yarn.lock, package-lock.json 等文件,再拉取一次package就行。淘宝镜像同步稍晚了一会,现在也已经ok了。
from component-compiler-utils.
window 10 下
cnpm i
rm node_modules/[email protected]@prettier
// 输入 a 回车
cnpm i prettier@~1.12.1 -D
from component-compiler-utils.
这个问题浪费了很多人的时间啊 。。。。
from component-compiler-utils.
Damn. Just decided to try the vue-cli out and ended up with the no parser error on a newly init'ed project. I was at a complete loss, but managed to find my way to the prettier breaking change. Good job finding a solution this quick and thanks, implemented this locally. 👍
from component-compiler-utils.
rm -rf node_modules
npm install
npm install prettier@~1.12.1
from component-compiler-utils.
nuxtjs
still doesn't work.... The same error with prettier
from component-compiler-utils.
@lanxin1234 是的,需要删掉,我是这样写的,成功了,感谢
rm -rf node_modules
cnpm cache verify
cnpm i
rm -rf node_modules/[email protected]@prettier
cnpm install --save-dev [email protected]
from component-compiler-utils.
@pwang2 not work, still get 1.13.0
npm view prettier version
from component-compiler-utils.
分享下,此官方修复只针对 vue-loader 15.x 版本,如果你项目引用的是 13.x/14.x等版本,与此修复无关,需升级 vue-loader 至 15.x版,
升级后需要注意不兼容更新:
https://vue-loader.vuejs.org/migrating.html#notable-breaking-changes
`// webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin')
module.exports = {
// ...
plugins: [
new VueLoaderPlugin()
]
}`
from component-compiler-utils.
npm install prettier@~1.12.1 这个是可以的
from component-compiler-utils.
In prettier 1.13.0, default parser was removed with a minor version(used to be babylon), this breaks the formatter here.
是在prettier的 1.13.0版本,默认的一个解析器被移除了导致项目创建失败?
这个影响比较大啊。
弄了半天才正常跑起来。
踩坑日志 https://www.whatled.com/post-6206.html
from component-compiler-utils.
Yarn and npm registries are still pointing to 1.13.0, not 1.13.1.
from component-compiler-utils.
- npm i prettier@~1.12.1
- rm -rf node_modules/
- npm i
works
from component-compiler-utils.
in ./src/App.vue
Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (/Users/lanc/Desktop/runbuild/node_modules/_prettier@1.13.0@prettier/index.js:7051:13)
at formatWithCursor (/Users/lanc/Desktop/runbuild/node_modules/_prettier@1.13.0@prettier/index.js:10370:12)
at /Users/lanc/Desktop/runbuild/node_modules/_prettier@1.13.0@prettier/index.js:31115:15
at Object.format (/Users/lanc/Desktop/runbuild/node_modules/_prettier@1.13.0@prettier/index.js:31134:12)
at Object.module.exports (/Users/lanc/Desktop/runbuild/node_modules/_vue-loader@13.7.1@vue-loader/lib/template-compiler/index.js:80:23)
@ ./src/App.vue 11:0-392
@ ./src/main.js
@ multi ./node_modules/_webpack-dev-server@2.11.2@webpack-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
from component-compiler-utils.
How to solve this?
from component-compiler-utils.
@lovemyliwu if you are using customized tools or npm link, it might be tricky and requires you to target the package tree correctly.
You might also need to regenerate you pacakge-lock.json or yarn.lock file.
from component-compiler-utils.
Merged.
Thanks @yyx990803 ! We could expect a new version of @vue/component-compiler-utils
soon.
from component-compiler-utils.
还是不行啊,尤大婶
from component-compiler-utils.
rm -rf package-lock.json node_modules
npm install
from component-compiler-utils.
rm -rf node_modules npm install npm install prettier@~1.12.1
亲测有效,谢谢~
from component-compiler-utils.
you can try
cd node_modules/
rm -rf _prettier@1.13.0@prettier
cnpm install prettier@~1.12.1
(if your node_modules/ have _prettier@1.13.0@prettier )
from component-compiler-utils.
@lanxin1234 it work with this manual install.
@transtone only [email protected]
has this error. It use [email protected]
. But [email protected]
is the newest stable version....
from component-compiler-utils.
上面的方法都试了,还是报错
from component-compiler-utils.
rm -rf node_modules npm install npm install prettier@~1.12.1
我的成功了
from component-compiler-utils.
楼上我也是不行~
今天打算把线上的分支拉多一个到本地做迭代.
然后装完package就报错了.
旧的包是可以的.
我还以为是跟同事更新代码搞错了 - -
from component-compiler-utils.
rm -rf node_modules
npm install
rm -rf node_modules/_prettier@1.13.0@prettier
npm install prettier@~1.12.1
试试这样
from component-compiler-utils.
删 node_modules
npm install
npm run dev
可以了
from component-compiler-utils.
我也在报错
from component-compiler-utils.
怎么做的?
from component-compiler-utils.
npm install --save-dev [email protected]
from component-compiler-utils.
nuxt项目有大佬搞定了么,
nuxt@1.4.0
npm install --save-dev prettier@1.12.1
也不行
from component-compiler-utils.
@chengzhuotc 升级完vue -loader 后 没有其他的报错吗?有解决吗
from component-compiler-utils.
from component-compiler-utils.
为什么我npm install --save-dev [email protected]也会报错
from component-compiler-utils.
@huyajie
这样做就好了
from component-compiler-utils.
from component-compiler-utils.
不知道是不是和node环境有关,我用的是10点几版本的,然后照着上面试了很多次不行,然后我吧vue-loader升级最新版本,
在改下配置,然后照着上面降级就可以了
from component-compiler-utils.
用的是 vue 2.3.0 和 vue -loader 14.2.1, 删了node_modules后重新npm install后还是报错;但手动install 1.12.1 版本的 prettier 就可以了
from component-compiler-utils.
作为一个node小白,这问题我也弄了一个多小时,最先还以为我哪里代码写错了,查了一通才查到这里,谷歌真牛掰,这个issue10几个小时前提的,谷歌就能搜出来了。
顺便鄙视一下百度
from component-compiler-utils.
难道这问题作者没关注么?
from component-compiler-utils.
用 vue init 生成新项目,竟然报错, 好神奇啊。。。
from component-compiler-utils.
感觉没权威性啊,老报错。。。
from component-compiler-utils.
@Tianxiaofeng 报错啊
from component-compiler-utils.
@yangguang111lll 我也报错, 老项目可以的。 奇怪。
from component-compiler-utils.
nuxt项目解决了
在推送服务器上,装完依赖过后,手动单独安装一次prettier就好了
from component-compiler-utils.
@yangguang111lll
window 10 下
cnpm i
rm node_modules/_prettier@1.13.0@prettier
// 输入 a 回车
cnpm i prettier@~1.12.1 -D
from component-compiler-utils.
试了4个小时,,试光了所有方法。。绝望
from component-compiler-utils.
心累
from component-compiler-utils.
I can't me too
from component-compiler-utils.
from component-compiler-utils.
为什么我用npm下载包可以,用yarn就不行了
from component-compiler-utils.
[email protected]版本,yarn不行,npm i OK
from component-compiler-utils.
mac 下各种不行,什么时候能修复,init就可以
from component-compiler-utils.
对于13.X 的 可以
删除node_modules下的[email protected]执行cnpm install --save-dev [email protected]好用
from component-compiler-utils.
还是不行,
from component-compiler-utils.
把所有依赖装好,然后cnpm install [email protected],然后重启如果还是不行打开node_modules找到[email protected]、[email protected],把[email protected]删掉就好了
from component-compiler-utils.
- 先要升级vue-loader版本
npm install --save-dev [email protected] - 删除node_modules
rm -rf node_modules - 重新加载依赖(淘宝镜像快一点)
cnpm install - prettier降级
cnpm install prettier@~1.12.1
from component-compiler-utils.
可以了,原来node_modules 下面有那么多prettier版本,这个bug还是尽早修复吧
from component-compiler-utils.
已经清除了yarn缓存
yarn cache clean
依然不能通过[email protected]解决,
npm就可以
from component-compiler-utils.
Still having an issue on Nuxtjs
version:
"nuxt": "^1.0.0",
"prettier": "^1.12.1"
For Nuxtjs this worked for me:
Go to: node_modules\vue-loader\lib\template-compiler open index.js
and look for
// prettify render fn
if (!isProduction) {
code = prettier.format(code, { semi: false})
}
and change line to below:
// prettify render fn
if (!isProduction) {
code = prettier.format(code, { semi: false, parser: 'babylon' })
}
Thats worked for me....
from component-compiler-utils.
有没有人能说一下这个产生的具体原因,对于旧的项目没有上传node_modules,如果现在install是不是都会出这个问题,感觉现在的解决方法不能解决根本问题
from component-compiler-utils.
这个直接影响线上项目迭代了,到底是什么问题导致的?
from component-compiler-utils.
@yyx990803 Want to lock this, edit the original post to say run:
npm update --depth=9999 @vue/component-compiler-utils
?
from component-compiler-utils.
如果用 yarn
, 可以在项目的 package.json 中添加:
"resolutions":{
"vue-loader/prettier": "1.12.1"
},
from component-compiler-utils.
UPDATE:
for vue-loader version 15, NO need to downgrade prettier version now
If you have applied downgrade above, remove it from pacakge.json then run
npm update --depth=9999 @vue/component-compiler-utils
if havn't, just run
npm update --depth=9999 @vue/component-compiler-utils
After this, you could validate the new version of @vue/component-compiler-utils
is 1.3.1. if yes, you are good to go.
npm list prettier
{project}@0.2.42 /Users/pwang2/Works/{project}
└─┬ [email protected]
└─┬ @vue/[email protected]
└── [email protected]
for old vue-loader like v14 and below, there is no @vue/component-compiler-utils
in between(see here), and reference was to prettier directly. we still have to use the prettier downgrade workaround addressed above by running
npm update --depth=9999 vue-loader
# updated since vue-loader has also patched with the parser hot fix.
中文开发者可以就近移步: https://segmentfault.com/q/1010000015052538/a-1020000015052553
from component-compiler-utils.
我试着
npm install prettier@~1.12.1 .
就ok了
from component-compiler-utils.
Related Issues (20)
- Clarification request about scoped style
- https://www.npmjs.com/advisories/1693
- with newes component-compiler-utils @3.2.2 , error
- Update postcss HOT 9
- Add License File
- Hash collision with `hash-sum` package
- Problem with `prettier@3` HOT 2
- [Feature Request] Bump prettier to version 3
- [Question] Less imports @import '~@pkg/path/to/stylesheet.less'
- CVE-2023-44270 on package dependencies HOT 9
- [email protected] is deprecated HOT 1
- Switch `prettier` to an optional- or peerDependency HOT 2
- :root Selector should not be scoped HOT 1
- typescript definition for SFCDescriptor isn't compatible with vue-template-compiler HOT 1
- npm ERR! 404 '@vue/component-compiler-utils@latest' is not in the npm registry. HOT 2
- Typo on README
- Cannot read property 'parseComponent' of undefined
- optionalDependencies are installed as normal dependencies HOT 4
- About debugging components defined by the same name HOT 1
- About adding a firstChar('@') in the templateCompilerModules/utils
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from component-compiler-utils.