Coder Social home page Coder Social logo

Comments (40)

ecosse3 avatar ecosse3 commented on May 29, 2024 3

Same issue here. Getting PackageInfo: Not in valid package.json file.

from package-info.nvim.

princejoogie avatar princejoogie commented on May 29, 2024 2

updated the plugin and it stopped working. getting the error PackageInfo: Not in valid package.json file also tried setting autostart: true but still not working

from package-info.nvim.

zeitchef avatar zeitchef commented on May 29, 2024 2

@vuki656 I'm also getting PackageInfo: Not in valid package.json file error

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024 1

@pedro757 @piersolenski @zeitchef @thomashoggard @Nikola-Milovic @ecosse3

Can you check if #130 solves the issue?

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

Now it does not show the previous error but it does nothing

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

Can you try reloading your terminal?

I just tried it with your package json file and it works as expected.

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

I tried but it's still the same

image
image

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

This happens when you run PackageInfoShow ?

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

:PackageInfoShow does nothing as well

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

is_loaded is never set to true

image

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

Oh, that's weird. Is the autocmd that sets it even being called?

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

Oh forget that part, I mistook the search, but the problem is here I think, because it will return without running the rest of the code

M.run = function(options)
if not state.is_loaded then
return
end

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

@princejoogie @zeitchef for which command are you getting that message? Also, is it a monorepo or a regular one?

Also, would you mind attaching the relevant package.json files?

I'm unable to reproduce the problem and would really like to figure out why it's happening.

from package-info.nvim.

zeitchef avatar zeitchef commented on May 29, 2024

@vuki656 I first noticed the issue on a work repo, which I can't really share. But I noticed the issue on my personal website as well when trying to PackageInfoUpdate:

{
  "version": "1.0.0",
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "test": "jest"
  },
  "dependencies": {
    "@nuxt/content": "^1.15.1",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/content": "^0.3.0",
    "@nuxtjs/gtm": "^2.4.0",
    "@nuxtjs/robots": "^2.5.0",
    "@nuxtjs/sentry": "^5.1.7",
    "core-js": "^3.21.1",
    "nuxt": "^2.15.8",
    "prism-themes": "^1.9.0"
  },
  "devDependencies": {
    "@nuxtjs/color-mode": "2.1.1",
    "@nuxtjs/google-fonts": "^1.3.0",
    "@nuxtjs/tailwindcss": "^5.0.2",
    "@vue/test-utils": "^1.3.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^27.5.1",
    "jest": "^27.5.1",
    "vue-jest": "^3.0.7"
  }
}

from package-info.nvim.

zeitchef avatar zeitchef commented on May 29, 2024

Also PackageInfoShow doesn't show anything for me anymore.

from package-info.nvim.

piersolenski avatar piersolenski commented on May 29, 2024

Same issue here 😥

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

@vuki656 I first noticed the issue on a work repo, which I can't really share. But I noticed the issue on my personal website as well when trying to PackageInfoUpdate:

{
  "version": "1.0.0",
  "license": "UNLICENSED",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "generate": "nuxt generate",
    "test": "jest"
  },
  "dependencies": {
    "@nuxt/content": "^1.15.1",
    "@nuxtjs/axios": "^5.13.6",
    "@nuxtjs/content": "^0.3.0",
    "@nuxtjs/gtm": "^2.4.0",
    "@nuxtjs/robots": "^2.5.0",
    "@nuxtjs/sentry": "^5.1.7",
    "core-js": "^3.21.1",
    "nuxt": "^2.15.8",
    "prism-themes": "^1.9.0"
  },
  "devDependencies": {
    "@nuxtjs/color-mode": "2.1.1",
    "@nuxtjs/google-fonts": "^1.3.0",
    "@nuxtjs/tailwindcss": "^5.0.2",
    "@vue/test-utils": "^1.3.0",
    "babel-core": "7.0.0-bridge.0",
    "babel-jest": "^27.5.1",
    "jest": "^27.5.1",
    "vue-jest": "^3.0.7"
  }
}

I just tried with this package JSON file on my pc and it works as expected.

It has to be conflicting with something else then.

Would you mind disabling all plugins and trying then? @piersolenski @princejoogie @pedro757 please try as well

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

Oh forget that part, I mistook the search, but the problem is here I think, because it will return without running the rest of the code

M.run = function(options)
if not state.is_loaded then
return
end

That is the idea yeah, if the plugin is not loaded then don't run the command. And by loaded, it means parsed the JSON file and knows about the dependencies.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

I'll have some time on Monday to debug this so ill look into it in more detail.

If someone has a solution feel free to open a PR.

from package-info.nvim.

thomashoggard avatar thomashoggard commented on May 29, 2024

Experiencing the same issue as @ecosse3 with the error PackageInfo: Not in valid package.json file. I'm using this plugin within a monorepo with turbo, not sure if that helps isolate the issue at all.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

I just merged #129. Not sure if that might help, please let me know.

Also, I removed the check on the develop branch, check if that fixes the issue.

from package-info.nvim.

ecosse3 avatar ecosse3 commented on May 29, 2024

@vuki656 Still getting the same error. Additionally on develop branch getting:

image

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

@ecosse3 do you have the latest version of this plugin?

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

I guess the next step would be to implement a detailed logger and see what exactly is going on.

I'll put it on my to-do list.

If anyone wants to submit a PR, I'd be happy to review it.

from package-info.nvim.

pedro757 avatar pedro757 commented on May 29, 2024

@vuki656 In my case it literally does nothing, it doesn't even show a message since you refactored the code.

from package-info.nvim.

Nikola-Milovic avatar Nikola-Milovic commented on May 29, 2024

NVIM v0.8.0-dev+580-g45ba2e147

Tried in multiple repos, same as Pedro I am getting absolutely no feedback, no errors, no output, running any of the commands results in not in valid package.json file.

Idk what could cause the conflict, maybe null-ls or jsonls?

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

NVIM v0.8.0-dev+580-g45ba2e147

Tried in multiple repos, same as Pedro I am getting absolutely no feedback, no errors, no output, running any of the commands results in not in valid package.json file.

Idk what could cause the conflict, maybe null-ls or jsonls?

Would you mind disabling those and seeing if it still happens?

from package-info.nvim.

Nikola-Milovic avatar Nikola-Milovic commented on May 29, 2024

@vuki656 disabling both didn't seem to fix the issue, still the same results

from package-info.nvim.

ecosse3 avatar ecosse3 commented on May 29, 2024

Now on develop branch, I'm getting different errors:

image

NVIM v0.8.0-dev-2239-g85ad0e6b4

from package-info.nvim.

Reicr avatar Reicr commented on May 29, 2024

I think the way of registering the auto commands is flawed. Since it always uses the same group, every time a new auto command is registered, all previous auto commands will be deleted because of "autocmd!". I tested this and every time only the last registered auto command worked.

return function(event, command)
    vim.cmd("augroup " .. constants.AUTOGROUP)
    vim.cmd("autocmd!")
    vim.cmd("autocmd " .. event .. " * " .. command)
    vim.cmd("augroup end")
end

This leads to the case that the "load_plugin()" function is never called and therefore the plugin never gets initialised resulting in the observed problems.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

I think the way of registering the auto commands is flawed. Since it always uses the same group, every time a new auto command is registered, all previous auto commands will be deleted because of "autocmd!". I tested this and every time only the last registered auto command worked.

return function(event, command)
    vim.cmd("augroup " .. constants.AUTOGROUP)
    vim.cmd("autocmd!")
    vim.cmd("autocmd " .. event .. " * " .. command)
    vim.cmd("augroup end")
end

This leads to the case that the "load_plugin()" function is never called and therefore the plugin never gets initialised resulting in the observed problems.

Oh, that's interesting, didn't know that.

Would you mind opening a PR with this fix?

from package-info.nvim.

Reicr avatar Reicr commented on May 29, 2024

Well, while trying to implement a fix I ran into another problem. The plugin now initialises but is reset shortly after so that I'm back to square one. Couldn't figure out yet why that is the case.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

Well, while trying to implement a fix I ran into another problem. The plugin now initialises but is reset shortly after so that I'm back to square one. Couldn't figure out yet why that is the case.

By reset you mean the autogroup clears or?

from package-info.nvim.

Reicr avatar Reicr commented on May 29, 2024

I think the problem was in the or is the __is_valid_package_json function since the autocmds use the "*" to define on which files the commands should be triggered. Not sure what happened in the background but I guess he somehow got a buffer that wasn't a package.json and disabled the plugin again. After I changed the pattern for the autocmds to only trigger on package.json files it worked.

from package-info.nvim.

ecosse3 avatar ecosse3 commented on May 29, 2024

@vuki656 Works great to me now! I just noticed funny that during actions of package-info.nvim in status bar my text is mirrored:
image

Rest works well

from package-info.nvim.

Reicr avatar Reicr commented on May 29, 2024

Did not touch that and it also works fine for me. I guess that's a separate problem. Although it should be confirmed, that this is actually a problem of the plugin and not just a problem of the status bar.

from package-info.nvim.

charigami avatar charigami commented on May 29, 2024

I still have this issue and was looking into the root cause. I'm using npm workspaces and have a directory structure similar to this:

root/
  backend/
  frontend-workspace/
    app/
      package.json
    package.json

When I open frontend-workspace directly and open app/package.json, everithing works fine. But when I open the root directory first and then open frontend-workspace/app/package.json the plugin does nothing. Hope it can help someone.

from package-info.nvim.

Reicr avatar Reicr commented on May 29, 2024

That is a different problem but it is certainly rather annoying. I opened up a pull request to fix this (#132). Feel free to test it.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 29, 2024

I still have this issue and was looking into the root cause. I'm using npm workspaces and have a directory structure similar to this:

root/
  backend/
  frontend-workspace/
    app/
      package.json
    package.json

When I open frontend-workspace directly and open app/package.json, everithing works fine. But when I open the root directory first and then open frontend-workspace/app/package.json the plugin does nothing. Hope it can help someone.

This is due to #114. Can you try @Reicr PR and see if it works now?

from package-info.nvim.

charigami avatar charigami commented on May 29, 2024

@vuki656 I have tried @Reicr version ("feature/use-cwd-of-package-json" branch) and it works now. Thanks for the work, this was very annoying.

from package-info.nvim.

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.