networking工作者在执行时抛出404

我的项目结构看起来像

js /client.js /script1.js /webWoker.js node_modules .gitignore index.html 

main.html也包含在内

 <script type="text/javascript" src="js/script1.js"></script> <script type="text/javascript" src="js/client.js"></script> <script type="text/javascript" src="js/webWoker.js"></script> 

我的script1.js看起来像

 if (window.Worker) { console.log("uri: " + document.documentURI); var myWorker = new Worker("myworker.js"); myWorker.postMessage("hello"); console.log(myWorker); myWorker.onmessage = function (e) { result.textContent = e.data; console.log('Message received from worker: ' + result.textContent); }; } 

和我的webWorker.js看起来像

 onmessage = function (e) { console.log('Message received from main script'); var result = "#27ae60"; console.log('Posting message back to main script'); postMessage(result); }; 

我为这个项目使用node.js ,并通过npm start运行它,当我在浏览器中运行它时,我看到了

 script1.js:81 GET http://localhost:8080/webWorker.js 404 (Not Found) execute @ script1.js:81 img.onload @ script1.js:64 

这里怎么了?

       

网上收集的解决方案 "networking工作者在执行时抛出404"