[go: nahoru, domu]

Skip to content
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

Snap: Failed to read user shell environment #72042

Closed
NatoBoram opened this issue Apr 10, 2019 · 17 comments
Closed

Snap: Failed to read user shell environment #72042

NatoBoram opened this issue Apr 10, 2019 · 17 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug linux Issues with VS Code on Linux snap Issues related to the snap package upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded workbench-os-integration Native OS integration issues

Comments

@NatoBoram
Copy link
  • VSCode Version: 1.34.0-insider 56f1b47 x64
  • OS Version: Ubuntu 18.04.2 LTS x86_64

Steps to Reproduce:

  1. Install VSCode as a snap
  2. Install JSHint
  3. Install dbaeumer.jshint

Does this issue occur when all extensions are disabled?: N/A

I also reported it in microsoft/vscode-jshint#71, but it's probably unrelated to the extension itself.

@joaomoreno
Copy link
Member

@dbaeumer What can the user do to figure out what's wrong?

@dbaeumer
Copy link
Member

@RMacfarlane took that over. We might want to consider changing the publisher

@dbaeumer
Copy link
Member

If there anything in the JSHint output panel?

@joaomoreno joaomoreno added the info-needed Issue requires more information from poster label Apr 10, 2019
@NatoBoram
Copy link
Author
NatoBoram commented Apr 10, 2019

Even after selecting F1 JSHint : Show Output, the Output tab is empty. All I got is the error message.

Failed to load jshint library. Please install jshint in your workspace folder using npm install jshint or globally using npm install -g jshint and then press Retry.

image

@dbaeumer
Copy link
Member

@NatoBoram do you have jshint itself installed? Your workspace doesn't have a node_modules folder.

@joaomoreno
Copy link
Member

Also, can you reproduce with VS Code without Snap? https://update.code.visualstudio.com/latest/linux-x64/insider

@NatoBoram
Copy link
Author
NatoBoram commented Apr 12, 2019

@dbaeumer JSHint was installed globally. The workspace isn't a NodeJS project.

jshint --version
jshint v2.10.2

@joaomoreno
No. The .deb works fine.

@dbaeumer
Copy link
Member

@NatoBoram does it work if you install jshint locally?

@NatoBoram
Copy link
Author

Yes, it works when installed locally.

@joaomoreno
Copy link
Member

@NatoBoram Do you use NVM? If you open the Developer Tools and run getLazyEnv().then(console.log), do you get the expected environment?

@vscodebot vscodebot bot closed this as completed May 27, 2019
@vscodebot
Copy link
vscodebot bot commented May 27, 2019

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

@dbaeumer
Copy link
Member

Reopening.

@joaomoreno and I looked into this and the problem seems to be that the environment is not correctly sourced when running out of a snap which makes the server fail looking up global node moddules.

@dbaeumer dbaeumer reopened this May 27, 2019
@dbaeumer dbaeumer removed extensions Issues concerning extensions info-needed Issue requires more information from poster labels May 27, 2019
@joaomoreno joaomoreno changed the title Failed to load JSHint library if VSCode was installed as a Snap. Snap: Failed to read user shell environment May 28, 2019
@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug linux Issues with VS Code on Linux snap Issues related to the snap package workbench-os-integration Native OS integration issues labels May 28, 2019
@joaomoreno joaomoreno added this to the Backlog milestone May 28, 2019
@faraz5040
Copy link
faraz5040 commented May 28, 2019

Also faced this issue. the problem is with gnome launcher .desktop file. it does not run ~/.bashrc or any other shell environment file. running code from terminal inherits the environment and works just fine.
Fixed it temporarily by editing /var/lib/snapd/desktop/applications/code_code.desktop and changing the Exec line from:
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/code_code.desktop /snap/bin/code %U
to:
Exec=bash -c "source $HOME/.bashrc && env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/code_code.desktop /snap/bin/code %U"

@sgrf
Copy link
sgrf commented Aug 1, 2019

I have a similar issue but the above does not fix it.
If I add VSCode as a favorite from the UBUNTU dash and then click VSCode icon on the sidebar none of my scripts work in VSCode script explorer. I get npm not found.
If I start VSCode within a terminal everything works.

@sgrf
Copy link
sgrf commented Aug 1, 2019

I should have said "none of my npm scripts work

@joaomoreno
Copy link
Member
joaomoreno commented Sep 5, 2019

Root cause: https://forum.snapcraft.io/t/new-store-automated-review-rule-is-incorrect/12963/27?u=joaomoreno

Fix should come soon from the snapcraft team!

@joaomoreno joaomoreno added the upstream Issue identified as 'upstream' component related (exists outside of VS Code) label Sep 5, 2019
@joaomoreno
Copy link
Member

Fixed by #80585

cc @alexr00

@roblourens roblourens added the verified Verification succeeded label Oct 3, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug linux Issues with VS Code on Linux snap Issues related to the snap package upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded workbench-os-integration Native OS integration issues
Projects
None yet
Development

No branches or pull requests

7 participants