Reputation: 480
Every time Visual Studio Code started or loaded it shows an 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". Is there any solution available?
Upvotes: 20
Views: 31761
Reputation: 21
Open cmdr
or the Git bash terminal and enter npm install -g jshint
, then exit VS code and re-open it.
Upvotes: 2
Reputation: 11
Use sudo before npm install jshint
For the current workspace
sudo npm install jshint
or
For all your workspaces
sudo npm install -g jshint
Using sudo
with a command in LINUX/UNIX generally gives you the permissions to root level.
The root user has permission to access, modify or delete almost any file on your computer. Normal user accounts can access, modify or delete fewer files. This restrictions on normal user accounts are to protect your computer from unauthorized and harmful programs or users.
Thus, running the installation command with sudo
gives you the permissions of the superuser, and allows you to modify files that your normal user doesn't have permission to modify.
Upvotes: 1
Reputation: 785
Try uninstalling using "npm uninstall" and follow the link - https://marketplace.visualstudio.com/items?itemName=dbaeumer.jshint for reinstalling.
Upvotes: 0
Reputation: 5177
I had this problem while I had installed jshint
using yarn
globally (yarn global add jshint
). I added the following properties to settings.json
for User
to solve the problem:
"jshint.packageManager": "yarn",
"jshint.nodePath": "/usr/local/lib/node_modules/"
The first property i.e. jshint.packageManager
specifies that yarn
is used to manage node
packages instead of npm
. The second one i.e. jshint.nodePath
specifies the path of jshint
installation. To check if jshint
is loaded successfully, I opened Command pallet ( CTRL + 3) and ran command JSHint: Show output
which showed this message in the output:
jshint library loaded from /usr/local/lib/node_modules/jshint/src/jshint.js
It indicated that the problem was resolved. Afterwards, the jshint
messages appeared in *.js
files.
Upvotes: 11
Reputation: 31
For applying the changes to Global scope, and not only to a specific Workspace, use the following command in terminal:-
npm install -g jshint
For a particular workspace, use the following command in terminal:-
npm install jshint
Upvotes: 1
Reputation: 2519
You'll need to follow the prompt and install jshint.
For just the workspace
npm install jshint
or
For all your workspaces
npm install -g jshint
Upvotes: 31