dpa99c / cordova-check-plugins

A CLI tool to check for / manage plugin updates in Cordova/Phonegap projects.
216 stars 25 forks source link

Strange error (Error: Cannot find module 'semver') #1

Closed hebol closed 8 years ago

hebol commented 8 years ago

After installing the function in a phonegap v5.3.7 environment with: sudo npm install -g cordova-check-plugins

with the output:

/usr/local/bin/cordova-check-plugins -> /usr/local/lib/node_modules/cordova-check-plugins/index.js
cordova-check-plugins@1.0.4 /usr/local/lib/node_modules/cordova-check-plugins
├── jsonfile@2.2.3
├── cli-status@0.1.1
├── cli-spinner@0.2.4
├── underscore@1.8.3
├── colors@1.1.2
├── js-base64@2.1.9
├── minimist@1.2.0
├── fs-extra@0.26.5 (path-is-absolute@1.0.0, klaw@1.1.3, graceful-fs@4.1.3, rimraf@2.5.1)
├── octonode@0.7.4 (deep-extend@0.4.1, randomstring@1.1.4, request@2.51.0)
├── cordova-common@1.0.0 (unorm@1.4.1, cordova-registry-mapper@1.1.15, q@1.4.1, semver@5.1.0, osenv@0.1.3, shelljs@0.5.3, bplist-parser@0.1.1, elementtree@0.1.6, glob@5.0.15, plist@1.2.0)
├── inquirer@0.12.0 (figures@1.4.0, ansi-regex@2.0.0, strip-ansi@3.0.0, ansi-escapes@1.1.1, through@2.3.8, rx-lite@3.1.2, cli-width@2.0.0, chalk@1.1.1, readline2@1.0.1, string-width@1.0.1, cli-cursor@1.0.2, run-async@0.1.0, lodash@4.3.0)
└── xml2js@0.4.16 (sax@1.1.5, xmlbuilder@4.2.1)

When running: cordova-check-plugins

I get this (for me) strange error:

Error: Cannot find module 'semver'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/cordova-check-plugins/index.js:15:14)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)

Have I missed anything?

crissi commented 8 years ago

same here

dpa99c commented 8 years ago

I'll have a look at this later. I was "getting around" to fixing the dependency version numbers in the package.json and that may have come back to bite me: may be a dependency issue as it was working OK when I last installed it (a couple of weeks back).

hebol commented 8 years ago

Great! You don't get this quick response for paid services...

Cheers // Martin

dpa99c commented 8 years ago

may be a dependency issue as it was working OK when I last installed it

Turns out I forgot to add "semver" as a dependency to package.json and didn't notice as I have that module globally installed. v1.0.5 should fix it.

May need to to sudo npm uninstall -g cordova-check-plugins && sudo npm install -g cordova-check-plugins

Let me know if that works or not.

hebol commented 8 years ago

..and there was much rejoicing! Excellent service!

For me it was enough with the command: sudo npm install -g cordova-check-plugins

/Martin

crissi commented 8 years ago

Still getting an error just different, this happens when I run cordova-check-plugins in the console on Windows:

C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\node_modules\semver\semver.js:293
    throw new TypeError('Invalid Version: ' + version);
          ^
TypeError: Invalid Version: 1.0.1.1
    at new SemVer (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\node_modules\semver\semver.js:293:11)
    at SemVer.compare (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\node_modules\semver\semver.js:342:13)
    at compare (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\node_modules\semver\semver.js:566:31)
    at Function.eq (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\node_modules\semver\semver.js:605:10)
    at compareVersions (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\index.js:176:25)
    at checkedRemoteVersion (C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\index.js:166:9)
    at C:\Users\ME\AppData\Roaming\npm\node_modules\cordova-check-plugins\index.js:115:9
    at ChildProcess.exithandler (child_process.js:742:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)