Comments (40)
Same issue here. Getting PackageInfo: Not in valid package.json file
.
from package-info.nvim.
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.
@vuki656 I'm also getting PackageInfo: Not in valid package.json file
error
from package-info.nvim.
@pedro757 @piersolenski @zeitchef @thomashoggard @Nikola-Milovic @ecosse3
Can you check if #130 solves the issue?
from package-info.nvim.
Now it does not show the previous error but it does nothing
from package-info.nvim.
Can you try reloading your terminal?
I just tried it with your package json file and it works as expected.
from package-info.nvim.
I tried but it's still the same
from package-info.nvim.
This happens when you run PackageInfoShow
?
from package-info.nvim.
:PackageInfoShow
does nothing as well
from package-info.nvim.
is_loaded
is never set to true
from package-info.nvim.
Oh, that's weird. Is the autocmd
that sets it even being called?
from package-info.nvim.
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
package-info.nvim/lua/package-info/actions/show.lua
Lines 13 to 17 in 45e409c
from package-info.nvim.
@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.
@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.
Also PackageInfoShow
doesn't show anything for me anymore.
from package-info.nvim.
Same issue here 😥
from package-info.nvim.
@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.
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
package-info.nvim/lua/package-info/actions/show.lua
Lines 13 to 17 in 45e409c
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.
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.
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.
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.
@vuki656 Still getting the same error. Additionally on develop
branch getting:
from package-info.nvim.
@ecosse3 do you have the latest version of this plugin?
from package-info.nvim.
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.
@vuki656 In my case it literally does nothing, it doesn't even show a message since you refactored the code.
from package-info.nvim.
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.
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.
@vuki656 disabling both didn't seem to fix the issue, still the same results
from package-info.nvim.
Now on develop
branch, I'm getting different errors:
NVIM v0.8.0-dev-2239-g85ad0e6b4
from package-info.nvim.
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.
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") endThis 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.
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.
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.
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.
@vuki656 Works great to me now! I just noticed funny that during actions of package-info.nvim in status bar my text is mirrored:
Rest works well
from package-info.nvim.
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.
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.
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.
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.
@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)
- Fetch and display repo release notes HOT 1
- Loading hook in vim-airline HOT 4
- Bug trying to edit a `package.json` with unsaved changes HOT 3
- [BUG] Not in valid package.json file | after refactor HOT 2
- [BUG]: Once a package.json is loaded, every buffer after shows that it is invalid HOT 2
- [FEATURE REQUEST] Support nvim-notify HOT 4
- [BUG] setting wrong colors HOT 7
- [FEATURE REQUEST] Update Readme keymap config examples with description HOT 1
- [FEATURE REQUEST] add option to configure the order of detection of package manager HOT 3
- [FEATURE REQUEST] Support monorepo. HOT 3
- [BUG] Plugin doesn't work when lazy loaded HOT 1
- [FEATURE REQUEST] fire autocmd on loading status change HOT 1
- [FEATURE REQUEST] support for bun HOT 1
- [BUG] remove icon for `require('package-info').get_status()` HOT 2
- [BUG] Spinner "not included" HOT 2
- [BUG] Error when key contained in dependencies and devDependencies HOT 2
- [FEATURE REQUEST] Option to only change the version in `package.json` without running `npm/yarn/pnpm` command HOT 3
- [BUG] Error when diffing package.json
- [BUG] "encoding" npm package in package.json leads to error HOT 3
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 package-info.nvim.