-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: pnpm is already installed in the current workspace and does not work. #1475
Conversation
b9dc4fd
to
74c7dae
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not first try locally and then globally?
No, |
Any progress on this? I have the same error as mentioned in #1474 and this would fix it 😉 |
Sorry, has to wait until next week. Busy with other things. |
try { | ||
pnpmPath = execSync('pnpm root -g').toString().trim(); | ||
} catch { | ||
pnpmPath = execSync('pnpm root').toString().trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you enclosed that as a catch
to avoid any behavior breaking change. But unless we want to make that a customizable settings to force global pnpm use instead of local one, I don't think this is necessary, is it?
I would simply remove the -g
flag from the original source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #1475 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what I'm saying ;). Since pnpm root
will always return the path, there is no need to keep the pnpm root -g
line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what I'm saying ;). Since
pnpm root
will always return the path, there is no need to keep thepnpm root -g
line.
When you don't have pnpm
installed locally, executing pnpm root
will return a non-existent path, which will cause a more serious error.
Unless there is a better way to fix this problem, we must use pnpm root -g
as a preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dunqing What about checking if the local path exists and falling back to pnpm root -g
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dunqing What about checking if the local path exists and falling back to
pnpm root -g
? 🤔
Sounds good.
Sorry for the long delay. Disclaimer: I have little knowledge about When you are talking about having If this is the case then the proposed PR will not work since If this is incorrect what does it mean to have |
Yes.
I don't think it's related to |
But how should this find
|
This is correct, but we need to check if the path exists #1475 (comment). If it doesn't exist, we run Or you can work with the current PR approach. |
May be I still misunderstand this. In the example you gave me So this will not work if pnpm isn't installed globally as well. Right? And could this lead to some version mismatch where the global |
I have only installed globally.
Yes, that's right. Because this PR is just to solve the issue of #1474.
Yes, this is the expected behavior, or we can finally fallback to
Yes, but there shouldn't be any problems. We should actually use the local |
There is actually a way to find this out. Have a look at: vscode-eslint/server/src/eslint.ts Line 833 in 8eeb994
This is how I find the |
Is it possible to add a configuration option for users to manually configure where the extension should look for the |
This more or less exist with the |
Hi all, I ran into the problem with After searching for a while and going through this discussion, I removed the @dbaeumer would it be worth to build and try the Before: [Info - 3:15:16 PM] ESLint server is starting
[Info - 3:15:16 PM] ESLint server running in node v16.14.2
[Info - 3:15:16 PM] ESLint server is running.
Uncaught exception received.
Error: Command failed: pnpm root -g
at checkExecSyncError (node:child_process:848:11)
at execSync (node:child_process:922:15)
at node:electron/js2c/asar_bundle:5:12704
at Object.get (<path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:23876)
at e.get (<path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:23985)
at <path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:19323
Uncaught exception received.
Error: Command failed: pnpm root -g
at checkExecSyncError (node:child_process:848:11)
at execSync (node:child_process:922:15)
at node:electron/js2c/asar_bundle:5:12704
at Object.get (<path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:23876)
at e.get (<path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:23985)
at <path-to-user>/.vscode/extensions/dbaeumer.vscode-eslint-2.2.6/server/out/eslintServer.js:1:19323 After: [Info - 3:08:38 PM] ESLint server is starting
[Info - 3:08:38 PM] ESLint server running in node v16.14.2
[Info - 3:08:38 PM] ESLint server is running.
[Info - 3:08:42 PM] ESLint library loaded from: <path-to-project>/react-frontend/node_modules/.pnpm/registry.npmjs.org+eslint@8.23.0/node_modules/eslint/lib/api.js |
I tried a clean
I think that is the reason why the call actually fails. The reason why the eslint server wants the global installation directory is to be able to find eslint if it is not installed locally. So removing the Can someone example to me why |
After running |
@dbaeumer experienced this as well, I wrote my comment after fixing it using Is there anything that could help find the root cause for it? Some logging for instance? |
You could try If this doesn't help I can provide you with steps how to debug this if you are willing to do so. |
@dbaeumer just enabled the tracing, and voilà magically it also works with For anyone else: Please try to get |
I'm sorry, but are there any updates? |
I will close the PR for now. As it turned out Please ping if someone has an idea to avoid the additional setup step. |
close: #1474