Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example failing with Error: Cannot find module '..' on MacOS 10.10.2 #24

Closed
jvelliott opened this issue Feb 17, 2015 · 6 comments · Fixed by jvelliott/node-slack-client#1

Comments

@jvelliott
Copy link

Sorry if this is a noob problem, as I am new to node.js and coffeescript.

When I try running the steps in example.js, I get the following error:

[RAZORBOAR ~/src/node-slack-client] npm install

> ws@0.4.31 install /Users/jelliott/src/node-slack-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
log@1.4.0 node_modules/log

should@2.0.2 node_modules/should

grunt-shell@0.5.0 node_modules/grunt-shell
└── stripcolorcodes@0.1.0

coffee-script@1.9.0 node_modules/coffee-script

grunt-release@0.6.1 node_modules/grunt-release
├── semver@2.0.11
├── shelljs@0.1.4
└── superagent@0.15.7 (methods@0.0.1, cookiejar@1.3.0, debug@0.7.4, qs@0.6.5, emitter-component@1.0.0, reduce-component@1.0.1, mime@1.2.5, formidable@1.0.14)

mocha@1.13.0 node_modules/mocha
├── diff@1.0.7
├── growl@1.7.0
├── commander@0.6.1
├── mkdirp@0.3.5
├── debug@2.1.1 (ms@0.6.2)
├── glob@3.2.3 (inherits@2.0.1, graceful-fs@2.0.3, minimatch@0.2.14)
└── jade@0.26.3 (mkdirp@0.3.0)

grunt-contrib-coffee@0.12.0 node_modules/grunt-contrib-coffee
├── uri-path@0.0.2
├── chalk@0.5.1 (escape-string-regexp@1.0.2, ansi-styles@1.1.0, supports-color@0.2.0, strip-ansi@0.3.0, has-ansi@0.1.0)
├── coffee-script@1.8.0 (mkdirp@0.3.5)
└── lodash@2.4.1

grunt-contrib-watch@0.5.3 node_modules/grunt-contrib-watch
├── tiny-lr@0.0.4 (debug@0.7.4, faye-websocket@0.4.4, noptify@0.0.3, qs@0.5.6)
└── gaze@0.4.3 (globule@0.1.0)

grunt@0.4.5 node_modules/grunt
├── which@1.0.8
├── dateformat@1.0.2-1.2.3
├── eventemitter2@0.4.14
├── getobject@0.1.0
├── rimraf@2.2.8
├── colors@0.6.2
├── async@0.1.22
├── hooker@0.2.3
├── grunt-legacy-util@0.2.0
├── exit@0.1.2
├── nopt@1.0.10 (abbrev@1.0.5)
├── lodash@0.9.2
├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0)
├── coffee-script@1.3.3
├── underscore.string@2.2.1
├── glob@3.1.21 (inherits@1.0.0, graceful-fs@1.2.3)
├── iconv-lite@0.2.11
├── findup-sync@0.1.3 (glob@3.2.11, lodash@2.4.1)
├── grunt-legacy-log@0.1.1 (underscore.string@2.3.3, lodash@2.4.1)
└── js-yaml@2.0.5 (argparse@0.1.16, esprima@1.0.4)

ws@0.4.31 node_modules/ws
├── tinycolor@0.0.1
├── options@0.0.6
├── commander@0.6.1
└── nan@0.3.2
[RAZORBOAR ~/src/node-slack-client] cd examples
[RAZORBOAR ~/src/node-slack-client/examples] node simple.js 
module.js:338
    throw err;
          ^
Error: Cannot find module '..'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/jelliott/Documents/ws-src/node-slack-client/examples/simple.js:11:13)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

Interestingly, I can run bin/slack no problem:

[RAZORBOAR ~/src/node-slack-client/] bin/slack xoxb-TOKEN
[Tue Feb 17 2015 00:00:26 GMT-0800 (PST)] INFO Connecting...
Welcome to Slack. You are mrroboto of Team funslack
You are in: #general
> /help
Commands:
/msg channel text
/join channel
/leave channel
/quit

With other googling, I've seen some people ask for the npm ls

[RAZORBOAR ~/src/node-slack-client/] npm ls
slack-client@1.3.1 /Users/jelliott/src/node-slack-client
├── coffee-script@1.9.0
├─┬ grunt@0.4.5
│ ├── async@0.1.22
│ ├── coffee-script@1.3.3
│ ├── colors@0.6.2
│ ├── dateformat@1.0.2-1.2.3
│ ├── eventemitter2@0.4.14
│ ├── exit@0.1.2
│ ├─┬ findup-sync@0.1.3
│ │ ├─┬ glob@3.2.11
│ │ │ ├── inherits@2.0.1
│ │ │ └─┬ minimatch@0.3.0
│ │ │   ├── lru-cache@2.5.0
│ │ │   └── sigmund@1.0.0
│ │ └── lodash@2.4.1
│ ├── getobject@0.1.0
│ ├─┬ glob@3.1.21
│ │ ├── graceful-fs@1.2.3
│ │ └── inherits@1.0.0
│ ├─┬ grunt-legacy-log@0.1.1
│ │ ├── colors@0.6.2
│ │ ├── lodash@2.4.1
│ │ └── underscore.string@2.3.3
│ ├─┬ grunt-legacy-util@0.2.0
│ │ ├── async@0.1.22
│ │ ├── lodash@0.9.2
│ │ └── underscore.string@2.2.1
│ ├── hooker@0.2.3
│ ├── iconv-lite@0.2.11
│ ├─┬ js-yaml@2.0.5
│ │ ├─┬ argparse@0.1.16
│ │ │ ├── underscore@1.7.0
│ │ │ └── underscore.string@2.4.0
│ │ └── esprima@1.0.4
│ ├── lodash@0.9.2
│ ├─┬ minimatch@0.2.14
│ │ ├── lru-cache@2.5.0
│ │ └── sigmund@1.0.0
│ ├─┬ nopt@1.0.10
│ │ └── abbrev@1.0.5
│ ├── rimraf@2.2.8
│ ├── underscore.string@2.2.1
│ └── which@1.0.8
├─┬ grunt-contrib-coffee@0.12.0
│ ├─┬ chalk@0.5.1
│ │ ├── ansi-styles@1.1.0
│ │ ├── escape-string-regexp@1.0.2
│ │ ├─┬ has-ansi@0.1.0
│ │ │ └── ansi-regex@0.2.1
│ │ ├─┬ strip-ansi@0.3.0
│ │ │ └── ansi-regex@0.2.1
│ │ └── supports-color@0.2.0
│ ├─┬ coffee-script@1.8.0
│ │ └── mkdirp@0.3.5
│ ├── lodash@2.4.1
│ └── uri-path@0.0.2
├─┬ grunt-contrib-watch@0.5.3
│ ├─┬ gaze@0.4.3
│ │ └─┬ globule@0.1.0
│ │   ├─┬ glob@3.1.21
│ │   │ ├── graceful-fs@1.2.3
│ │   │ └── inherits@1.0.0
│ │   ├── lodash@1.0.1
│ │   └─┬ minimatch@0.2.14
│ │     ├── lru-cache@2.5.0
│ │     └── sigmund@1.0.0
│ └─┬ tiny-lr@0.0.4
│   ├── debug@0.7.4
│   ├── faye-websocket@0.4.4
│   ├─┬ noptify@0.0.3
│   │ └─┬ nopt@2.0.0
│   │   └── abbrev@1.0.5
│   └── qs@0.5.6
├─┬ grunt-release@0.6.1
│ ├── semver@2.0.11
│ ├── shelljs@0.1.4
│ └─┬ superagent@0.15.7
│   ├── cookiejar@1.3.0
│   ├── debug@0.7.4
│   ├── emitter-component@1.0.0
│   ├── formidable@1.0.14
│   ├── methods@0.0.1
│   ├── mime@1.2.5
│   ├── qs@0.6.5
│   └── reduce-component@1.0.1
├─┬ grunt-shell@0.5.0
│ └── stripcolorcodes@0.1.0
├── log@1.4.0
├─┬ mocha@1.13.0
│ ├── commander@0.6.1
│ ├─┬ debug@2.1.1
│ │ └── ms@0.6.2
│ ├── diff@1.0.7
│ ├─┬ glob@3.2.3
│ │ ├── graceful-fs@2.0.3
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.2.14
│ │   ├── lru-cache@2.5.0
│ │   └── sigmund@1.0.0
│ ├── growl@1.7.0
│ ├─┬ jade@0.26.3
│ │ └── mkdirp@0.3.0
│ └── mkdirp@0.3.5
├── should@2.0.2
└─┬ ws@0.4.31
  ├── commander@0.6.1
  ├── nan@0.3.2
  ├── options@0.0.6
  └── tinycolor@0.0.1
@jvelliott jvelliott changed the title Example failing with Error: Cannot find module '..' on MacOS Example failing with Error: Cannot find module '..' on MacOS 10.10.2 Feb 17, 2015
@jvelliott
Copy link
Author

@wiggly
Copy link

wiggly commented Feb 17, 2015

Similarly a node newbie and having the same problem on Linux.

@evansolomon
Copy link
Contributor

Pretty sure this is because the CoffeeScript isn't compiled and by default the example JavaScript file can't load it. Can you try making the first line of code (before var Slack...) say require('coffee-script/register')?

I think that should work. Let me know, if so I'll update the example.

(note: this is just an issue with the example, not with the actual package, because the CoffeeScript is compiled to JavaScript when it's published to npm)

@wiggly-admedo
Copy link

Yes, adding that allows the example to work.

@evansolomon
Copy link
Contributor

Thanks. I added that line to the example.

@jvelliott
Copy link
Author

Confirmed working.

Thanks so much!

aoberoi added a commit to aoberoi/node-slack-sdk that referenced this issue Mar 20, 2019
address typo and clarify  option use cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants