WebStorm There is no locally stored library

2020-07-03 07:19发布

问题:

I'have been working on a project which totally works on jsfiddle.net . However, when i try to run this project in webStorm, i get two errors.

first :

second :

Before, i post my question here, i searched on stackoverflow but couldn't find any solutions. I already did :

libraries:

and my html codes :

<!DOCTYPE html>
<html>
<head>
    <title>Super Mario!</title>
    <link rel='stylesheet' type='text/css' href='myMario.css'/>

    <script type='text/javascript' src='//code.jquery.com/jquery-1.11.2.min.js'></script>
</head>
<body>
<img src="http://i1061.photobucket.com/albums/t480/ericqweinstein/mario.jpg"/>
</body>
</html>

why did u get these errors although i loaded libraries and succesfully defined source script in my html ? what should i do ?

回答1:

  1. Seems that you get the error when running your .js file directly, via 'Run file_name.js' in it's right-click menu, right? When doing this you are running it using Node.js. But 'document' can't be used in server-side scripts executed by Node.js. It is only defined in client-side javascript, i.e. when running in the browser via a tag in the rendered HTML, not the Javascript API engine running on the server. BTW, your .js file is not even included in your HTML page, as far as I can see from HTML code snippet...

  2. This is not actually an error... WebStorm can't use remote resources available through CDN links for completion. Once it 'sees' such links, it searches for the corresponding library in ~.WebStorm9\system\extLibs\, and, if matching library is not found, prompts you to download it by showing this warning. You can either suppress this warning or agree to download the library: hit Alt+Enter and then either hit the right arrow and choose 'Suppress for tag' or hit Enter to download.



回答2:

You need to select this file link and click Alt + Enter to download this file to your library.

Screen from WebStorm: