node-which icon indicating copy to clipboard operation
node-which copied to clipboard

Error: Cannot find module '../'

Open Ricket opened this issue 8 years ago • 3 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.

Ricket avatar Jun 08 '17 19:06 Ricket

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

kartolo avatar Aug 26 '19 13:08 kartolo

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?

isaacs avatar Aug 28 '19 01:08 isaacs

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.

kartolo avatar Aug 28 '19 10:08 kartolo