![](/img/trans.png)
[英]Why is it necessary to run 'npm install' when I already have all the dependence in node_module folder
[英]how to access node_module directory which was out side the static content serving folder
需要從位於子目錄內的index.html文件訪問node_module目錄文件,並且node_module目錄位於父目錄的同一位置。 在這里我使用angularjs,服務器文件的靜態文件夾是公共目錄。
app.use(express.static(__ dirname +'/ public'));
屏幕快照中提供了目錄結構。 在此處輸入圖片說明
也可以為node_modules文件夾嘗試此操作
app.use(express.static(__dirname + '/node_modules'));
然后在index.html中,您可以直接訪問例如node_modules文件夾的子目錄。
<script src="async/component.json"></script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.