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

Unable to run on Win 8.1 #74

Closed
LebedevAntony opened this issue May 15, 2015 · 18 comments
Closed

Unable to run on Win 8.1 #74

LebedevAntony opened this issue May 15, 2015 · 18 comments

Comments

@LebedevAntony
Copy link

I've got the exception on build grunt on my windows 8.1 PC:
"Unable to execute: C:/node_modules/.bin/grunt"

As I guess the problem lays in defining path to grunt in file tools/Grunt.js:

exec: fs.existsSync(path + '/node_modules/.bin/grunt') ? path + '/node_modules/.bin/grunt' : 'grunt',

Since I've made a stub for this case:

module.exports.settings = function (path) {
  if (process.platform === 'win32') {
    var homePath = process.env.APPDATA + '/npm/Grunt.cmd';
    path = homePath.replace(/\\/g, '/');
  } else {
    path = path + '/node_modules/.bin/grunt';
  }

  return {
    exec: fs.existsSync(path) ? path : 'grunt',
    sh: false
  };
};

it works fine.
It looks like that this problem is common for all build tools on win pc, if so, is it possible to fix?

@noseglid
Copy link
Owner

From what I can tell, there should be a "binary" named grunt even on Windows. You have to make sure it is in your path though. Please see this issue or this issue, and let me know if that helps you.

@LebedevAntony
Copy link
Author

I have two files in local grunt folder: 1) grunt 2) grunt.cmd and the same files in global grunt folder.
If I use

exec: fs.existsSync(path + '/node_modules/.bin/grunt') ? path + '/node_modules/.bin/grunt' : 'grunt'

it doesn't work, but if I change it to:

exec: fs.existsSync(path + '/node_modules/.bin/grunt.cmd') ? path + '/node_modules/.bin/grunt.cmd' : 'grunt'

it works perfect.

Also I've tried to use globally installed grunt but without success. I added grunt folder to PATH

C:\Users\username\AppData\Roaming\npm

but it does't work

@noseglid
Copy link
Owner

I see. We definitely need to do something about this. Any windows dev who'd care to take a jab at this?

I'd assume the path separator is not correct either (should be \ on Windows, no?). I think the value of this (/ or \) can be found by

var path = require('path');
console.log(path.sep);

@figgyc
Copy link

figgyc commented May 25, 2015

@noseglid yep the path sep is \ on Windows. I have a feeling that the inconsistent slashes is what's screwing it over

@noseglid
Copy link
Owner

I could change it throughout the package to use platform specific path separator, but I'd have no way of testing it since I don't have any Windows platform at my disposal. If you guys would help me test it, maybe we could get something done?

@figgyc
Copy link

figgyc commented May 27, 2015

Sure I can help ya test it. I'm running 8.1 aswell.

@noseglid
Copy link
Owner

Allright, so I altered all the path variables so they should be platform specific (path separator is ; and folder separator is \).

I really need some help testing it. It is on the branch dev/generic-paths. To test it (modifications might be needed for windows):

git clone https://github.com/noseglid/atom-build -b dev/generic-paths
cd atom-build
apm install
apm link

and reload atom. I'm looking forward to hearing if it works.

@figgyc
Copy link

figgyc commented May 28, 2015

Uncaught TypeError: Cannot read property 'replace' of undefined

C:\Users\George\.atom\packages\build\lib\build.js:144
TypeError: Cannot read property 'replace' of undefined
  at Object.module.exports.replace (C:\Users\George\.atom\packages\build\lib\build.js:144:18)
  at Object.<anonymous> (C:\Users\George\.atom\packages\build\lib\build.js:256:24)
  at forOwn (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\node_modules\cheerio\node_modules\lodash\dist\lodash.js:2106:15)
  at Function.forEach (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\node_modules\cheerio\node_modules\lodash\dist\lodash.js:3303:9)
  at Object.module.exports.startNewBuild (C:\Users\George\.atom\packages\build\lib\build.js:255:7)
  at Object.<anonymous> (C:\Users\George\.atom\packages\build\lib\build.js:322:14)
  at saveAndContinue (C:\Users\George\.atom\packages\build\lib\build.js:332:7)
  at Object.module.exports.doSaveConfirm (C:\Users\George\.atom\packages\build\lib\build.js:336:14)
  at Object.module.exports.build (C:\Users\George\.atom\packages\build\lib\build.js:318:10)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\src\command-registry.js:238:29)
  at C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\src\command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:519:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:354:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (C:\Users\George\AppData\Local\atom\app-0.201.0\resources\app.asar\src\window-event-handler.js:178:20)

it didnt work :(

@noseglid
Copy link
Owner

It seems as you didn't get the right code. Those stack traces doesn't match what is on the branch dev/generic-paths.

@figgyc
Copy link

figgyc commented May 28, 2015

Okay I'll try again. It's just i did'nt get stack traces before.

@figgyc
Copy link

figgyc commented May 28, 2015

Executing: S:\Projects\CeeSS\node_modules.bin\gulp default
Unable to execute: S:\Projects\CeeSS\node_modules.bin\gulp

New log it runs this time though. Almost X-Actly the same 🔪 but with right paths.

I got it! On WinDOwS, you need to run gulp.cmd instead of gulp.

@figgyc
Copy link

figgyc commented May 28, 2015

In fact that would need all of them for the most part to use .cmd

@noseglid
Copy link
Owner

Cool. I've added so it uses gulp.cmd, grunt.cmd, npm.cmd or apm.cmd if it is run under windows platform. I've pushed this to dev/generic-paths. Mind giving it another go?

@figgyc
Copy link

figgyc commented May 28, 2015

Right I'll redownload

@figgyc
Copy link

figgyc commented May 28, 2015

Sorry about that, I just needed cough meds 😠 . Anyway so I got the latest patch, and.....

Arguments to path.join must be strings
TypeError: Arguments to path.join must be strings
  at f (path.js:178:13)
  at Object.filter (native)
  at Object.win32.join (path.js:183:38)
  at Object.module.exports.isEligable (S:\Projects\git\atom-build\lib\tools\atom-build.js:10:29)
  at S:\Projects\git\atom-build\lib\build.js:156:23
  at arrayFilter (S:\Projects\git\atom-build\node_modules\lodash\index.js:1409:13)
  at Function.filter (S:\Projects\git\atom-build\node_modules\lodash\index.js:6289:14)
  at Object.<anonymous> (S:\Projects\git\atom-build\lib\build.js:155:18)
  at Object.tryCatcher (S:\Projects\git\atom-build\node_modules\bluebird\js\main\util.js:24:31)
  at Promise._settlePromiseFromHandler (S:\Projects\git\atom-build\node_modules\bluebird\js\main\promise.js:454:31)
  at Promise._settlePromiseAt (S:\Projects\git\atom-build\node_modules\bluebird\js\main\promise.js:530:18)
  at Promise._settlePromiseAtPostResolution (S:\Projects\git\atom-build\node_modules\bluebird\js\main\promise.js:224:10)
  at Async._drainQueue (S:\Projects\git\atom-build\node_modules\bluebird\js\main\async.js:182:12)
  at Async._drainQueues (S:\Projects\git\atom-build\node_modules\bluebird\js\main\async.js:187:10)
  at Immediate.Async.drainQueues [as _onImmediate] (S:\Projects\git\atom-build\node_modules\bluebird\js\main\async.js:15:14)
  at processImmediate [as _immediateCallback] (timers.js:369:17)

in the build log ( not stack trace)

@noseglid
Copy link
Owner

What... how did you open Atom? The path that it claims is not a path should be the root folder of the currently opened project. I don't see how the changes I've done to gulp, grunt, npm and apm build tools can affect that...

@figgyc
Copy link

figgyc commented May 28, 2015

Oh it's just cause I was looking at files outside of the directory. After restarting atom it works! 😄

@noseglid
Copy link
Owner

That is great! Altough I might wanna do something about that anyway. Thanks for helping me resolving this!

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

No branches or pull requests

3 participants