npm / node-which

Like which(1) unix command. Find the first instance of an executable in the PATH.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: Cannot find module '../'

Ricket opened this issue · comments

I am on macOS Sierra, running node 7.6.0 (installed via nvm). I find that when I run which (this node module), I get the following error:

module.js:472
    throw err;
    ^

Error: Cannot find module '../'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/carter/Dev/node_modules/.bin/which:2:13)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)

If I update line 2 of node_modules/.bin/which to instead be var which = require("../which") then the script succeeds.

+1 to this. I'm on Mojave with node v12.1.0

What does this command print?

ls -laF node_modules/.bin/which

It should be a symbolic link. If it isn't, then something is fishy. How did you install it?

Hi @isaacs,

I was installing https://github.com/bchatard/alfred-jetbrains (Workflow for the Alfred App on Mac OSX). In the workflow installation is node_modules/.bin/which not a symlink.