命令未找到:nodemon ---需要帮助将目录添加到PATH

时间:2016-03-09 19:11:44

标签: node.js macos path npm nodemon

我在这里看了很多答案,但我仍然无法解决这个问题。我正在尝试再次学习节点,但在我全局安装nodemon(已成功完成)之后,我在运行 nodemon app.js 时收到命令:nodemon 。不久前,由于某种原因,我将我的npm路径移动到 / Users / mlefkowi / npm-global 。当我回显$ PATH 时,该目录不存在。这就是我得到的:

DECLARE @userID INT = xxxx ;WITH cte1 AS ( SELECT customerID , SUM(purchase_dollars) AS purchase_amount FROM customer_table GROUP BY customerID) , cte_rank AS ( SELECT customerID , RANK() OVER(ORDER BY purchase_amount DESC) AS purchase_amount_rank --, ROW_NUMBER() OVER(ORDER BY purchase_amount DESC) AS purchase_amount_rank --This will get you 10 records FROM cte1) SELECT t1.CustomerID , t2.purchase_amount_rank FROM customer_table t1 INNER JOIN cte_rank t2 ON t1.customerid = t2.customerid WHERE t2.purchase_amount_rank <= 10 UNION SELECT t1.customerID , t2.purchase_amount_rank FROM customer_table t1 INNER JOIN cte_rank t2 ON t1.customerid = t2.customerid AND t1.customer_id = @userID ORDER BY t2.purchase_amount_rank

我已经能够将它添加到$ PATH,但当我关闭终端时它不会保存。我应该将npm移回它的默认目录吗?如何获得保存到$ PATH的路径?

1 个答案:

答案 0 :(得分:1)

编辑〜/ .bashrc并添加以下行:

export PATH="/Users/mlefkowi/npm-global:$PATH"

这假设/Users/mlefkowi/npm-global/nodemon是nodemon可执行文件的路径。如果它位于npm-global之外的bin子目录中,则将/Users/mlefkowi/npm-global更改为/Users/mlefkowi/npm-global/bin

.bashrc是每次shell启动时获取的,因此这个修改将适用于所有新的终端会话。首次编辑后,运行source ~/.bashrc以更新该会话的PATH。