Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

HOME environment variable might not be available on Windows #12

Closed
tinhdv opened this issue Jul 13, 2017 · 6 comments
Closed

HOME environment variable might not be available on Windows #12

tinhdv opened this issue Jul 13, 2017 · 6 comments
Milestone

Comments

@tinhdv
Copy link

tinhdv commented Jul 13, 2017

I'm integrating Sonar to my nodejs project and when I run gulp to execute sonar, I got following error:

[11:43:47] 'sonar' errored after 61 ms
[11:43:47] TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:468:7)
at getSonarQubeScannerExecutable (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\sonarqube-scanner\dist\sonarqub
e-scanner-executable.js:58:30)
at scan (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\sonarqube-scanner\dist\index.js:21:5)
at Gulp. (C:\Users\IBM_ADMIN\AR_Projects\ar-api\gulpfile.js:103:3)
at module.exports (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\orchestrator\index.js:134:8)
at C:\Users\IBM_ADMIN\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20

@bellingard
Copy link
Owner

Which Node version are you using? Are you on a 32bit Windows installation?

Looks like the problem is similar to what is described here: https://stackoverflow.com/questions/9080085/node-js-find-home-directory-in-platform-agnostic-way

To confirm this, can you try the following:

  1. Open C:\Users\IBM_ADMIN\AR_Projects\ar-api\node_modules\sonarqube-scanner\dist\sonarqub e-scanner-executable.js
  2. At line Test AS #58, replace process.env.HOME by require('os').homedir()
  3. Try to execute the analysis and see if it succeeds or not

@tinhdv
Copy link
Author

tinhdv commented Jul 13, 2017

I'm using Node V6.9.2 and on 64bit windows. Let me try with your recommendation

@tinhdv
Copy link
Author

tinhdv commented Jul 13, 2017

I confirm that your recommendation is working, could you update the code for windows ? so other people will not face same issue.

Thank you so much @bellingard!

@bellingard bellingard changed the title Can't excute sonar v1.2.0 on windows 7 HOME environment variable might not be available on Windows Jul 13, 2017
@bellingard
Copy link
Owner

Thanks for the confirmation, I will push a fix soon.
And thanks for reporting the bug!

@bellingard
Copy link
Owner

@tinhdv New version is published, enjoy!

@tinhdv
Copy link
Author

tinhdv commented Jul 13, 2017

Cool!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants