parse-server-modules / parse-server-sns-adapter

Parse Server SNS Adapter
18 stars 14 forks source link

Can't find module #2

Closed nitrag closed 8 years ago

nitrag commented 8 years ago

Added to packages.json, ran "npm install".

Error: Cannot find module 'parse-server-sns-adapter/SNSPushAdapter'
    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/ryan/Documents/Parse/parse-offroad-server/index.js:6:22)
    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)
flovilmart commented 8 years ago

try var SNSPushAdatper = require('parse-server-sns-adapter')

nitrag commented 8 years ago

Module issue?

var SNSPushAdapter = require('parse-server-sns-adapter');
/Users/ryan/Documents/Parse/parse-offroad-server/node_modules/parse-server-sns-adapter/src/SNSPushAdapter.js:5
const Parse = require('parse/node').Parse;
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    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 Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/ryan/Documents/Parse/parse-offroad-server/node_modules/parse-server-sns-adapter/src/index.js:1:84)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
flovilmart commented 8 years ago

Add 'use strict' at the top of your file

nitrag commented 8 years ago

Same error after adding strict to top of parse-server-example. The problem is SNSPushAdapter.js has "use strict" at the top. If I take "strict" out of both files I get another error:

/Users/ryan/Documents/Parse/parse-offroad-server/node_modules/parse-server-sns-adapter/src/SNSPushAdapter.js:24
        let pushTypes = Object.keys(pushConfig.pushTypes);
            ^^^^^^^^^
SyntaxError: Unexpected identifier
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    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 Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/ryan/Documents/Parse/parse-offroad-server/node_modules/parse-server-sns-adapter/src/index.js:1:84)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

@rogerhu

flovilmart commented 8 years ago

This should not be a problem, the tests pass properly on node 4.3, that means that 'use strict' should not be a problem. And SNSPushAdapter is supposed to have 'use strict' to use block scoped variables like let and const

flovilmart commented 8 years ago

What's your version of node? I suspect you use a version earlier than 4.3 therefore, that won't work. Please update to 4.3 or 4.4

rogerhu commented 8 years ago

I fixed the issue already..do another npm install of the module

rogerhu commented 8 years ago

Your 2nd issue @flovilmart thanks for pointing out

rogerhu commented 8 years ago

Fixed readme for import issud

nitrag commented 8 years ago

So sorry, somehow was using wrong version of node. Thanks for your patience with my dumb self!