Giter Club home page Giter Club logo

Comments (69)

pwang2 avatar pwang2 commented on September 21, 2024 14

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.

yyx990803 avatar yyx990803 commented on September 21, 2024 12

Released in 1.3.1

from component-compiler-utils.

yyx990803 avatar yyx990803 commented on September 21, 2024 8

remove node_modules and reinstall everything.

from component-compiler-utils.

transtone avatar transtone commented on September 21, 2024 8

@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.

xiaofan9 avatar xiaofan9 commented on September 21, 2024 8

window 10 下

cnpm i
rm node_modules/[email protected]@prettier
// 输入 a 回车
cnpm i prettier@~1.12.1 -D

from component-compiler-utils.

suncunhu avatar suncunhu commented on September 21, 2024 6

这个问题浪费了很多人的时间啊 。。。。

from component-compiler-utils.

Tarpsvo avatar Tarpsvo commented on September 21, 2024 4

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.

lanxin1234 avatar lanxin1234 commented on September 21, 2024 4

rm -rf node_modules
npm install
npm install prettier@~1.12.1

from component-compiler-utils.

JesonRondo avatar JesonRondo commented on September 21, 2024 4

nuxtjs still doesn't work.... The same error with prettier

from component-compiler-utils.

fyddaben avatar fyddaben commented on September 21, 2024 4

@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.

lovemyliwu avatar lovemyliwu commented on September 21, 2024 3

@pwang2 not work, still get 1.13.0
npm view prettier version

from component-compiler-utils.

qidaizhe11 avatar qidaizhe11 commented on September 21, 2024 3

分享下,此官方修复只针对 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.

hejialianghe avatar hejialianghe commented on September 21, 2024 2

npm install prettier@~1.12.1 这个是可以的

from component-compiler-utils.

sxyseo avatar sxyseo commented on September 21, 2024 2

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.

5amfung avatar 5amfung commented on September 21, 2024 1

Yarn and npm registries are still pointing to 1.13.0, not 1.13.1.

from component-compiler-utils.

caszhou avatar caszhou commented on September 21, 2024 1

For [email protected]

  • npm i prettier@~1.12.1
  • rm -rf node_modules/
  • npm i

works

from component-compiler-utils.

lanxin1234 avatar lanxin1234 commented on September 21, 2024

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.

lanxin1234 avatar lanxin1234 commented on September 21, 2024

How to solve this?

from component-compiler-utils.

pwang2 avatar pwang2 commented on September 21, 2024

@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.

pwang2 avatar pwang2 commented on September 21, 2024

Merged.

Thanks @yyx990803 ! We could expect a new version of @vue/component-compiler-utils soon.

from component-compiler-utils.

liuhuidi avatar liuhuidi commented on September 21, 2024

还是不行啊,尤大婶

from component-compiler-utils.

pwang2 avatar pwang2 commented on September 21, 2024
rm -rf package-lock.json node_modules
npm install

from component-compiler-utils.

liuhuidi avatar liuhuidi commented on September 21, 2024

rm -rf node_modules npm install npm install prettier@~1.12.1
亲测有效,谢谢~

from component-compiler-utils.

lanxin1234 avatar lanxin1234 commented on September 21, 2024

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.

JesonRondo avatar JesonRondo commented on September 21, 2024

@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.

momolizi avatar momolizi commented on September 21, 2024

上面的方法都试了,还是报错

from component-compiler-utils.

outstandinglife avatar outstandinglife commented on September 21, 2024

rm -rf node_modules npm install npm install prettier@~1.12.1
我的成功了

from component-compiler-utils.

superfff avatar superfff commented on September 21, 2024

楼上我也是不行~

今天打算把线上的分支拉多一个到本地做迭代.
然后装完package就报错了.
旧的包是可以的.

我还以为是跟同事更新代码搞错了 - -

from component-compiler-utils.

outstandinglife avatar outstandinglife commented on September 21, 2024

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.

tabqiang avatar tabqiang commented on September 21, 2024

删 node_modules
npm install
npm run dev
可以了

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

我也在报错

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

怎么做的?

from component-compiler-utils.

jadepam avatar jadepam commented on September 21, 2024

npm install --save-dev [email protected]

from component-compiler-utils.

luanwulin avatar luanwulin commented on September 21, 2024

nuxt项目有大佬搞定了么,

nuxt@1.4.0
npm install --save-dev prettier@1.12.1

也不行

from component-compiler-utils.

huyajie avatar huyajie commented on September 21, 2024

@chengzhuotc 升级完vue -loader 后 没有其他的报错吗?有解决吗

from component-compiler-utils.

liuhuidi avatar liuhuidi commented on September 21, 2024

from component-compiler-utils.

anqing-kingjay avatar anqing-kingjay commented on September 21, 2024

为什么我npm install --save-dev [email protected]也会报错

from component-compiler-utils.

chengzhuotc avatar chengzhuotc commented on September 21, 2024

@huyajie
image这样做就好了

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

default 还是不行

from component-compiler-utils.

chengzhuotc avatar chengzhuotc commented on September 21, 2024

不知道是不是和node环境有关,我用的是10点几版本的,然后照着上面试了很多次不行,然后我吧vue-loader升级最新版本,
image
在改下配置,然后照着上面降级就可以了

from component-compiler-utils.

blairzhao111 avatar blairzhao111 commented on September 21, 2024

用的是 vue 2.3.0 和 vue -loader 14.2.1, 删了node_modules后重新npm install后还是报错;但手动install 1.12.1 版本的 prettier 就可以了

from component-compiler-utils.

xuebingwang avatar xuebingwang commented on September 21, 2024

作为一个node小白,这问题我也弄了一个多小时,最先还以为我哪里代码写错了,查了一通才查到这里,谷歌真牛掰,这个issue10几个小时前提的,谷歌就能搜出来了。

顺便鄙视一下百度

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

难道这问题作者没关注么?

from component-compiler-utils.

tianxiaofeng747 avatar tianxiaofeng747 commented on September 21, 2024

用 vue init 生成新项目,竟然报错, 好神奇啊。。。

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

感觉没权威性啊,老报错。。。

from component-compiler-utils.

yangguang111lll avatar yangguang111lll commented on September 21, 2024

@Tianxiaofeng 报错啊

from component-compiler-utils.

tianxiaofeng747 avatar tianxiaofeng747 commented on September 21, 2024

@yangguang111lll 我也报错, 老项目可以的。 奇怪。

from component-compiler-utils.

luanwulin avatar luanwulin commented on September 21, 2024

nuxt项目解决了
在推送服务器上,装完依赖过后,手动单独安装一次prettier就好了
image

from component-compiler-utils.

xiaofan9 avatar xiaofan9 commented on September 21, 2024

@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.

jkf8x8 avatar jkf8x8 commented on September 21, 2024

试了4个小时,,试光了所有方法。。绝望

from component-compiler-utils.

hlg-facai avatar hlg-facai commented on September 21, 2024

心累

from component-compiler-utils.

ChenArno avatar ChenArno commented on September 21, 2024

I can't me too

from component-compiler-utils.

liuhuidi avatar liuhuidi commented on September 21, 2024

from component-compiler-utils.

momolizi avatar momolizi commented on September 21, 2024

为什么我用npm下载包可以,用yarn就不行了

from component-compiler-utils.

gracelinmumu avatar gracelinmumu commented on September 21, 2024

[email protected]版本,yarn不行,npm i OK

from component-compiler-utils.

ChenArno avatar ChenArno commented on September 21, 2024

mac 下各种不行,什么时候能修复,init就可以

from component-compiler-utils.

13463736868 avatar 13463736868 commented on September 21, 2024

对于13.X 的 可以
删除node_modules下的[email protected]执行cnpm install --save-dev [email protected]好用

from component-compiler-utils.

ChenArno avatar ChenArno commented on September 21, 2024

还是不行,

from component-compiler-utils.

WormGirl avatar WormGirl commented on September 21, 2024

把所有依赖装好,然后cnpm install [email protected],然后重启如果还是不行打开node_modules找到[email protected][email protected],把[email protected]删掉就好了

from component-compiler-utils.

sundew26 avatar sundew26 commented on September 21, 2024
  1. 先要升级vue-loader版本
    npm install --save-dev [email protected]
  2. 删除node_modules
    rm -rf node_modules
  3. 重新加载依赖(淘宝镜像快一点)
    cnpm install
  4. prettier降级
    cnpm install prettier@~1.12.1

from component-compiler-utils.

ChenArno avatar ChenArno commented on September 21, 2024

可以了,原来node_modules 下面有那么多prettier版本,这个bug还是尽早修复吧

from component-compiler-utils.

luanwulin avatar luanwulin commented on September 21, 2024

已经清除了yarn缓存
yarn cache clean
依然不能通过[email protected]解决,
npm就可以

from component-compiler-utils.

Shardik04 avatar Shardik04 commented on September 21, 2024

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.

WormGirl avatar WormGirl commented on September 21, 2024

有没有人能说一下这个产生的具体原因,对于旧的项目没有上传node_modules,如果现在install是不是都会出这个问题,感觉现在的解决方法不能解决根本问题

from component-compiler-utils.

royalrover avatar royalrover commented on September 21, 2024

这个直接影响线上项目迭代了,到底是什么问题导致的?

from component-compiler-utils.

azz avatar azz commented on September 21, 2024

@yyx990803 Want to lock this, edit the original post to say run:

npm update --depth=9999 @vue/component-compiler-utils

?

from component-compiler-utils.

Baoyx007 avatar Baoyx007 commented on September 21, 2024

如果用 yarn, 可以在项目的 package.json 中添加:

"resolutions":{
"vue-loader/prettier": "1.12.1"
},

from component-compiler-utils.

pwang2 avatar pwang2 commented on September 21, 2024

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.

hu-qi avatar hu-qi commented on September 21, 2024

我试着
npm install prettier@~1.12.1 .
就ok了

from component-compiler-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.