1

I have installed WebStorm 2019.3 and there is a weird unresolved function warning for a bcryptjs library. The project is Node.js and I did npm install.

There are other dependencies working fine but this particular does not. Any idea?

const bcrypt = require('bcryptjs');
const jwt = require('jsonwebtoken');
const MongoClient = require('mongodb').MongoClient;

MongoClient.connect(uri) // OK, not highlighted
const token = jwt.sign({ // OK, not highlighted

if (bcrypt.compareSync(password, user.password)) { // KO, highlighted as unresolved

1 Answer 1

3

Please try un-excluding node_modules\bcryptjs\dist folder: right-click it, choose Mark directory As/Not Excluded; re-open the project.

I'd also suggest installing bcryptjs typings for better coding assistance: put cursor on 'bcryptjs' in require('bcryptjs'), hit Alt+Enter, choose Install Typescript definitions for better type informaion. See https://www.jetbrains.com/help/webstorm/2019.3/configuring-javascript-libraries.html#ws_jsconfigure_libraries_ts_definition_files

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, installing the typescript definitions made a difference!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.