GithubHelp home page GithubHelp logo

Comments (23)

CiGit avatar CiGit commented on May 26, 2024 3

I've seen it, the fix is here #74
As a current workaround, be sure your package.json contains dependencies and devDependencies. They may be empty {}

from prettier-vscode.

didasy avatar didasy commented on May 26, 2024 2

I got this exact same problem after updating.

EDIT:

I got it to work by adding "prettier": "^1.1.10" to devDependencies and do npm install

from prettier-vscode.

mogarick avatar mogarick commented on May 26, 2024

Hi @CiGit,
Mi package.json has dependencies and devDependencies objects with many properties.
screen shot 2017-04-13 at 10 25 03 am

from prettier-vscode.

mogarick avatar mogarick commented on May 26, 2024

I've also checked the prettier package.json included with the extension and it's not empty either.

screen shot 2017-04-13 at 10 32 28 am

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Can you also check in parent package.json if any?

from prettier-vscode.

jtulk avatar jtulk commented on May 26, 2024

I'm having the same problem after the update.

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Also no package.json without dependencies and devDependencies?
on the path from / to your file ?

from prettier-vscode.

mogarick avatar mogarick commented on May 26, 2024

@CiGit the parent package.json also appears OK, with the dependencies properly declared (esbenp.prettier-vscode-0.13.0/package.json):
screen shot 2017-04-13 at 1 26 59 pm

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

I was meaning in package.json located along the path

/
  package.json
  a/
    package.json
    b/
     .....
        workspace
          package.json
          dir/
            fileToFormat.js

This are the place where it could occur.

from prettier-vscode.

mogarick avatar mogarick commented on May 26, 2024

@CiGit There only 1 package.json in my project tree is a CRA(create-react-app) and goes as follow:

/ProjectRoot
  /node_modules
  /src
    myfileToFormat.js
  package.json (My project. No empty deps objects)

the only additional package.json files are the ones related to the proper project dependencies but they're in the node_modules directory which is not along my src files path.

Is it more clear now?

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

I still don't know where it can come from. Is it possible for you to debug it? I won't ask your entire file system 😈

from prettier-vscode.

jtulk avatar jtulk commented on May 26, 2024

Like @JesusIslam - things resolved for me when installing Prettier locally into the repo. So it seems like VSCode might not be checking for a globally installed copy and defaulting to that?

from prettier-vscode.

didasy avatar didasy commented on May 26, 2024

@jtulk #67 seems right, it needs to be explicitly installed now.

from prettier-vscode.

mogarick avatar mogarick commented on May 26, 2024

Indeed!
I installed prettier as devDependency and the problem was solved.
It would be excellent to add a note in the readme.md that prettier needs to be available as a dependency for the project or at least installed as a global (I didn't check if it works when prettier is installed as global module).

from prettier-vscode.

didasy avatar didasy commented on May 26, 2024

@mogarick it didn't work as a global for me at least.

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Just published 0.13.1 with a patch that should correct this issue. At least what I could reproduce.
@esbenp I finally found out how to publish ... was really tough

from prettier-vscode.

jtulk avatar jtulk commented on May 26, 2024

@CiGit - Does the patch require a local install or will it work off a global install now? I'll be happy to do a PR to annotate the docs if it requires a local copy...

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

It loads prettier packed with the extension if there is no local install. It doesn't use your globally installed prettier.
PR welcome to update https://github.com/esbenp/prettier-vscode#prettier-resolution ;-)

from prettier-vscode.

tizmagik avatar tizmagik commented on May 26, 2024

I just hit this today VSCode Version 1.16.1, prettier-vscode 0.24.0 and had to install prettier locally to fix it (npm i -D prettier) it was working fine without that previously...

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

@tizmagik How was your setup before you installed prettier? Stack trace?

from prettier-vscode.

tizmagik avatar tizmagik commented on May 26, 2024

Where would the stacktrace be? All I saw was the Cannot read property 'prettier' of undefined message in the output tab

from prettier-vscode.

CiGit avatar CiGit commented on May 26, 2024

Damn, I also forgot some informations here. I meant debug it :-)
clone it, npm i, open it in vscode and F5 (Start debugging)

from prettier-vscode.

github-actions avatar github-actions commented on May 26, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from prettier-vscode.

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.