简体   繁体   中英

Node Error - Not allowed to load local resource

I am making a chat app with socket.io. When I want to pull the client file it gives me this error:

Not allowed to load local resource:file:///C:/%20/Users/x/Desktop/Node%20Code/Chat%20Bot/node_modules/socket.io-client/dist/socket.io.js

My html file:

<!DOCTYPE html>
<!doctype html>
<html>
  <head>
    <title>Chat App</title>
    <script src="file:///C: \Users\x\Desktop\Node Code\Chat Bot\node_modules\socket.io-client\dist\socket.io.js"></script>
  </head>
  <body>


  </body>
</html>

You won't be able to load a resource outside of the project directory or from a user level directory, hence you get the error "cannot access local resource error".

Place the file in the root folder of your project and then try to reference it. It will work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM