WebStorm There is no locally stored library

最后都变了- 提交于 2020-05-25 11:26:13

问题


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 : document is not defined

second : no locally stored librarry

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

libraries: libraries that i loaded

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:

screen from WebStorm



来源:https://stackoverflow.com/questions/29097611/webstorm-there-is-no-locally-stored-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!