[英]Importing a javascript file in another file and compiling using Node.js
您正在嘗試使用相對路徑導入外部模塊(安裝在node_modules
中) - ./collections/deque
。 這將在名為collections
的源代碼中的本地文件夾中查找,並嘗試在其中找到一個名為deque.js
的文件。 由於它不存在,因此您會收到module not found
的錯誤。
您必須從node_moduels
導入依賴項:
const Deque = require("collections/deque"); // see the missing ./ at the start of the path
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.