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

Install error on windows : path must be a string #5

Closed
basarat opened this Issue Jan 15, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@basarat
Contributor

basarat commented Jan 15, 2015

Here is an atom package where I am trying to install linter : https://github.com/TypeStrong/atom-typescript/blob/ae8171bbcfc268c7257f0cf24b29819efec3b692/lib/main/index.js#L3-L4

var apd = require('atom-package-dependencies');
apd.install();

my package.json https://github.com/TypeStrong/atom-typescript/blob/ae8171bbcfc268c7257f0cf24b29819efec3b692/package.json#L26-L30:

  "package-dependencies": {
      "linter": "//this field will be ignored right now"
  }

Callstack:

TypeError: path must be a string
  at TypeError (native)
  at Object.fs.openSync (fs.js:455:18)
  at Object.module.(anonymous function) [as openSync] (c:\Users\basaratsyed\AppData\Local\atom\app-0.172.0\resources\atom\common\lib\asar.js:422:20)
  at Object.fs.readFileSync (fs.js:313:15)
  at Object.fs.readFileSync (c:\Users\basaratsyed\AppData\Local\atom\app-0.172.0\resources\atom\common\lib\asar.js:329:27)
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\index.js:78:30
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\index.js:71:5
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\witwip.js:51:23
  at find (c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\witwip.js:95:12)
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\witwip.js:106:16
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\node_modules\read-package-json\read-json.js:80:40
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\node_modules\read-package-json\read-json.js:128:48
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\node_modules\read-package-json\node_modules\graceful-fs\graceful-fs.js:170:5
  at c:\Users\basaratsyed\.atom\packages\atom-typescript\node_modules\atom-package-dependencies\node_modules\witwip\node_modules\read-package-json\node_modules\graceful-fs\graceful-fs.js:179:5
  at fs.js:295:14
  at Object.oncomplete (fs.js:93:15)

Seems like a bug in witwip as shown below after analysis of the stacktrace

function getPackageJSONpath(callback){
  //returns path to 'package.json' in the Atom package that this is required by
  var findPkg = require('witwip');
  console.log('parent',module.parent); // correctly returns Module `c:\Users\basaratsyed\.atom\packages\atom-typescript\lib\main\index.js`
  findPkg(module.parent, function(err, pkgPath, pkgData) {
    var path = pkgPath; 
    console.log('path',path) // Probably the ERROR: path is undefined
    callback(path);
  });
}
@basarat

This comment has been minimized.

Show comment
Hide comment
@basarat

basarat Jan 15, 2015

Contributor

Okay figured it out, its because witwip doesn't use path.sep

Contributor

basarat commented Jan 15, 2015

Okay figured it out, its because witwip doesn't use path.sep

@basarat basarat referenced this issue Jan 15, 2015

Merged

fix for windows #2

@basarat basarat changed the title from Install error to Install error on windows : path must be a string Jan 15, 2015

@basarat

This comment has been minimized.

Show comment
Hide comment
@basarat

basarat Jan 15, 2015

Contributor

Since its published on 1.0.4 and we have "witwip": "1.0.x", so fixed!

Contributor

basarat commented Jan 15, 2015

Since its published on 1.0.4 and we have "witwip": "1.0.x", so fixed!

@basarat basarat closed this Jan 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment