How do I fix “No pubspec.yaml file found” in flutter?

后端 未结 23 1956
南方客
南方客 2021-02-07 02:46

I am using Windows 10 with VS Code, although I also tested it on PowerShell, and both produced the same result:

After creating a new flutter program, before editing anyt

相关标签:
23条回答
  • 2021-02-07 03:07

    You can use flutter clean command and then try

    flutter run In your terminal

    0 讨论(0)
  • 2021-02-07 03:08

    Got a similar error:

    The directory ../ does not contain a pubspec.
    

    This is because I was referring to a folder that did not have a pubspec.yaml file.

    Solution:

    Change from:

      file_picker:
        path: ../
    

    To

      file_picker:
        path: ./
    
    0 讨论(0)
  • 2021-02-07 03:08

    For me the culprit was OneDrive. I had to reinstall Windows 10 and when I did, it offered to setup OneDrive for me automatically. I thought - great, one less thing... Then later I realized that it had set itself up with the Files On Demand option set to true. Microsoft never ceases to elicit a facepalm from me with the things they think are great ideas. Just to verify that this was the problem, I copied the entire folder to a temporary location on my hard drive that wasn't synced to OneDrive and it ran fine.

    If something has been corrupted in the process of trying to build and run without all the files accessible, hopefully you have a recent commit from github (prior to putting the project on OneDrive) that you can clone. This is assuming your problem has the same cause as mine.

    0 讨论(0)
  • 2021-02-07 03:09

    you can find this pubspex.yaml in flutter in following location D:\Mobile-Dev\src\flutter\packages\flutter_tools open CMD change Directory into above location and now you can run flutter upgrades get and other command. This one is working complete fine for me. Hope this will work for you

    0 讨论(0)
  • 2021-02-07 03:09

    I saw this error for invalid pubspec.yaml content, like for example spaces before

    name: my_app
    

    like

        name: my_app`
    
    0 讨论(0)
  • 2021-02-07 03:09

    In my case, i was using a VS code in Windows 10 and when i created a new project by Flutter: New Project it failed to create the following project files & folders under the project location

    • android

    • ios

    • lib
    • pubspec.lock
    • pubspec.yaml and few more files.

    I tried creating another project and that successfully created with all the necessary files.

    Sound dumb but this is what exactly happened to me.

    Hope it helps someone.

    0 讨论(0)
提交回复
热议问题