Visual Studio Code Error - Failed to load jshint library
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.
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
Open cmdr
or the Git bash terminal and enter npm install -g jshint
, then exit VS code and re-open it.