Skip to content

Commit 91da224

Browse files
committed
fix: error when node-modules folder does not exist
1 parent 347dba7 commit 91da224

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

add-node-modules-path.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ Traverse the directory structure up, until reaching the user's home directory.
4343
Any path found is added to the `exec-path'."
4444
(interactive)
4545
(let* ((file (or (buffer-file-name) default-directory))
46+
(path (locate-dominating-file file "node_modules"))
4647
(home (expand-file-name "~"))
47-
(root (expand-file-name (locate-dominating-file file "node_modules")))
48+
(root (and path (expand-file-name path)))
4849
(roots '()))
4950
(while (and root (not (string= root home)))
5051
(let ((bindir (expand-file-name "node_modules/.bin/" root)))

0 commit comments

Comments
 (0)