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

Not Working In Windows #588

Open
jescalan opened this issue Dec 17, 2014 · 24 comments
Open

Not Working In Windows #588

jescalan opened this issue Dec 17, 2014 · 24 comments
Labels

Comments

@jescalan
Copy link
Owner

Right now, roots v3 does not work correctly on windows. This issue is the gathering place of all windows-related issues, and a place to send anyone who is asking about a problem they have had with roots on windows.

While having roots work on windows is important to us, the vast majority of our user-base is on mac and linux, and windows support continues getting pushed back by other priorities. If anyone is willing to help out with getting roots working better on windows, please let us know!

@monkeez
Copy link

monkeez commented Apr 7, 2015

I'm running on Windows 8.1 64bit, when I install roots I get this:

C:\Users\mitch>npm i roots -g
npm WARN optional dep failed, continuing fsevents@0.3.0
C:\Users\mitch\AppData\Roaming\npm\roots -> C:\Users\mitch\AppData\Roaming\npm\n
ode_modules\roots\bin\roots

> roots@3.0.2 postinstall C:\Users\mitch\AppData\Roaming\npm\node_modules\roots
> node ./post_install.js

---------------------------------------------------------
Roots uses analytics to help the core team to get a
better view of how developers use roots. All analytics
are collected anonymously, and analytics data is used
only to make roots better for everyone. However, if you
would like to disable analytics, you are welcome to do
so by running the command `roots analytics --disable`

Much like roots itself, roots' analytics are open source.
Check out http://roots.cx/analytics for more information.
---------------------------------------------------------
roots@3.0.2 C:\Users\mitch\AppData\Roaming\npm\node_modules\roots
├── open@0.0.5
├── graceful-fs@3.0.6
├── vinyl@0.4.6 (clone-stats@0.0.1, clone@0.2.0)
├── colors@1.0.3
├── mkdirp@0.5.0 (minimist@0.0.8)
├── chokidar@0.9.0 (recursive-readdir@0.0.2)
├── when@3.7.2
├── minimatch@2.0.4 (brace-expansion@1.1.0)
├── argparse@1.0.2 (sprintf-js@1.0.2)
├── coffee-script@1.9.1
├── readdirp@1.3.0 (graceful-fs@2.0.3, readable-stream@1.0.33, minimatch@0.2.14)

├── serve-static@1.9.2 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, se
nd@0.12.2)
├── rimraf@2.3.2 (glob@4.5.3)
├── update-notifier@0.3.1 (is-npm@1.0.0, string-length@1.0.0, chalk@1.0.0, semve
r-diff@2.0.0, latest-version@1.0.0)
├── keen.io@0.1.3 (underscore@1.5.2, superagent@0.21.0)
├── accord@0.16.1 (indx@0.2.3, convert-source-map@0.4.1, fobject@0.0.3, resolve@
1.1.6, glob@4.5.3, uglify-js@2.4.19)
├── configstore@0.3.2 (object-assign@2.0.0, xdg-basedir@1.0.1, user-home@1.1.1,
osenv@0.1.0, uuid@2.0.1, js-yaml@3.2.7)
├── charge@0.0.3 (infestor@0.2.0, colors@0.6.2, anti-matter@0.0.1, minimist@0.1.
0, node-uuid@1.4.3, escapist-middleware@0.0.2, morgan@1.0.1, pathologist-middlew
are@0.0.1, alchemist-middleware@0.0.4, hygienist-middleware@0.0.3, faye-websocke
t@0.7.3, connect@3.3.5, lodash.assign@2.4.1, lodash.remove@2.4.1, compression@1.
4.3, publicist-middleware@0.0.1, update-notifier@0.1.10, archivist-middleware@0.
0.1, apology-middleware@0.0.4)
├── lodash@3.6.0
├── sprout@0.1.5 (indx@0.2.3, which@1.0.9, osenv@0.1.0, ncp@2.0.0, ejs@2.2.4, un
derscore.string@3.0.3, lodash@3.3.1, inquirer@0.8.2)
├── ship@0.2.4 (indx@0.2.3, mime@1.3.4, fstream@1.0.4, minimatch@1.0.0, optimist
@0.6.1, argparse@0.1.16, file-map@0.0.1, tar@1.0.3, ftp@0.3.10, update-notifier@
0.2.2, coffee-script@1.8.0, ssh2@0.3.6, github@0.2.1, lodash@2.4.1, netlify@0.2.
1, bitballoon@0.2.1, request@2.55.0, heroku-client@1.5.0, js-yaml@3.2.7, inquire
r@0.8.2, aws-sdk@2.1.21)
└── npm@2.7.5

Which doesn't seem too bad? Just missing an optional dep. But then when I create a new project I get this:

C:\Users\mitch\Websites>roots new example-project
? Error: Command failed: C:\WINDOWS\system32\cmd.exe /s /c "npm install"
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! file C:\Users\mitch\.config\sprout\roots-base\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token 'r' at 1:1
npm ERR! root/package.json
npm ERR! ^
npm ERR! File: C:\Users\mitch\.config\sprout\roots-base\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\mitch\.config\sprout\roots-base\npm-debug.log

Potentially unhandled rejection [3] Error: Command failed: C:\WINDOWS\system32\c
md.exe /s /c "npm install"
npm ERR! install Couldn't read dependencies
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs
\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! file C:\Users\mitch\.config\sprout\roots-base\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token 'r' at 1:1
npm ERR! root/package.json
npm ERR! ^
npm ERR! File: C:\Users\mitch\.config\sprout\roots-base\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\mitch\.config\sprout\roots-base\npm-debug.log

  at ChildProcess.exithandler (child_process.js:751:12)
  at ChildProcess.emit (events.js:110:17)
  at maybeClose (child_process.js:1015:16)
  at Socket.<anonymous> (child_process.js:1183:11)
  at Socket.emit (events.js:107:17)
  at Pipe.close (net.js:485:12)

So there's some problem occurring reading the JSON file. Any ideas why this could be happening? Or any extra info you'd like me to provide?

@jescalan
Copy link
Owner Author

jescalan commented Apr 7, 2015

Huh, really weird. No idea, but that helps since I at least know where it's failing in general, seems like an issue with sprout...

@monkeez
Copy link

monkeez commented Apr 7, 2015

How does that package.json file it's erroring on get created? It's located in the roots-base folder, but this file doesn't exist in the roots-base repository on GitHub. Also the only text in this file is one line: root/package.json, which isn't a valid JSON file.

@jescalan
Copy link
Owner Author

jescalan commented Apr 7, 2015

Ah that seems like an older version (it's a symlink), but that has been
removed. Run roots tpl reset and try again that should clear the error

On Tue, Apr 7, 2015 at 5:34 AM Mitchell Coote notifications@github.com
wrote:

How does that package.json file it's erroring on get created? It's
located in the roots-base folder, but this file doesn't exist in the
roots-base repository on GitHub. Also the only text in this file is one
line: root/package.json, which isn't a valid JSON file.


Reply to this email directly or view it on GitHub
#588 (comment).

@monkeez
Copy link

monkeez commented Apr 7, 2015

Great thanks, so that fixed that problem but now I'm encountering another with roots watch. When I run roots watch the cmd prompt doesn't throw any errors and it says the compiling is complete, but then it opens up to this:

roots_watch_error

And this is what the directory structure looks after the compile:

|   .gitignore
|   app.coffee
|   app.production.coffee
|   package.json
|   readme.md
|   
+---assets
|   +---css
|   |       master.styl
|   |       _settings.styl
|   |       
|   +---img
|   |       .keep
|   |       
|   \---js
|           main.coffee
|           
+---node_modules
|                           
+---public
|   |   index.jade
|   |   
|   +---css
|   |       master.styl
|   |       master.styl.map
|   |       
|   +---img
|   |       .keep
|   |       
|   \---js
|           main.coffee
|           main.coffee.map
|           
\---views
        index.jade
        layout.jade

@jescalan
Copy link
Owner Author

jescalan commented Apr 8, 2015

Ok so this is the error that I've seen happening on windows in the past.
The reason this is happening is because the jade file is not being
compiled. This occurs on osx and linux when the jade node module has not
been installed, but you have a node modules folder here, check quickly
whether jade has been installed or not. If it has, this is a windows bug.
If not, it's a sprout bug and npm install is not being run.

On Tue, Apr 7, 2015 at 8:24 PM Mitchell Coote notifications@github.com
wrote:

Great thanks, so that fixed that problem but now I'm encountering another
with roots watch. When I run roots watch the cmd prompt doesn't throw any
errors and it says the compiling is complete, but then it opens up to this:

[image: roots_watch_error]
https://cloud.githubusercontent.com/assets/5214414/7035859/abdac240-ddd0-11e4-9aae-52a2cfb3a22e.PNG

And this is what the directory structure looks after the compile:

| .gitignore
| app.coffee
| app.production.coffee
| package.json
| readme.md
|
+---assets
| +---css
| | master.styl
| | _settings.styl
| |
| +---img
| | .keep
| |
| ---js
| main.coffee
|
+---node_modules
|
+---public
| | index.jade
| |
| +---css
| | master.styl
| | master.styl.map
| |
| +---img
| | .keep
| |
| ---js
| main.coffee
| main.coffee.map
|
---views
index.jade
layout.jade


Reply to this email directly or view it on GitHub
#588 (comment).

@sourcehunter
Copy link
Contributor

We are getting the red X, too. Our Jade, Coffee and Stylus files are compiled correctly, but not renamed.

@monkeez
Copy link

monkeez commented Apr 8, 2015

Yeah I'm getting the same as sourcehunter, the files in the public folder
look like they've compiled but they haven't been renamed.

On Thu, 9 Apr 2015 1:23 am sourcehunter notifications@github.com wrote:

We are getting the red X, too. Our Jade, Coffee and Stylus files are
compiled correctly, but not renamed.


Reply to this email directly or view it on GitHub
#588 (comment).

@jescalan
Copy link
Owner Author

jescalan commented Apr 8, 2015

Ah ok, maybe this is an easier issue to fix than I thought. The renaming
logic is here in roots:
https://github.com/jenius/roots/blob/master/lib/config.coffee#L138 -- any
thoughts? Could someone test this out?

On Wed, Apr 8, 2015 at 12:40 PM Mitchell Coote notifications@github.com
wrote:

Yeah I'm getting the same as sourcehunter, the files in the public folder
look like they've compiled but they haven't been renamed.

On Thu, 9 Apr 2015 1:23 am sourcehunter notifications@github.com wrote:

We are getting the red X, too. Our Jade, Coffee and Stylus files are
compiled correctly, but not renamed.


Reply to this email directly or view it on GitHub
#588 (comment).


Reply to this email directly or view it on GitHub
#588 (comment).

@sourcehunter
Copy link
Contributor

Thanks for the hint. This seems to be an error in the CoffeeScript compiler. Your RegExp compiles to:

res = res.replace(/\.[^\#{path.sep}]*$/, "." + ext));

It seems to parse \# as character class resulting in the interpolation beeing ignored.

There are two possible fixes:

  1. Put the backslash after the interpolation:

    res = res.replace(///\.[^#{path.sep}\]*$///, ".#{ext}")
  2. Introduce a seperate variable for the path seperator RegExp:

    if ext
      pathSepRegExp = path.sep.replace '\\', '\\\\'
      res = res.replace(///\.[^#{pathSepRegExp}]*$///, ".#{ext}")

I prefer the second solution, which also covers a few more (theoretical) cases.

@jescalan
Copy link
Owner Author

jescalan commented Apr 8, 2015

Woah, not the kind of bug I suspected! Thanks for the fix and breakdown. So
that you get the well-deserved credit for this fix, would you mind
submitting a PR for this fix?

On Wed, Apr 8, 2015 at 4:40 PM sourcehunter notifications@github.com
wrote:

Thanks for the hint. This seems to be an error in the CoffeeScript
compiler. Your RegExp compiles to:

res = res.replace(/.[^#{path.sep}]*$/, "." + ext));

It seems to parse # as character class resulting in the interpolation
beeing ignored.

There are two possible fixes:

Put the backslash after the interpolation:

res = res.replace(///.[^#{path.sep}]*$///, ".#{ext}")

2.

Introduce a seperate variable for the path seperator RegExp:

if ext
pathSepRegExp = path.sep.replace '', '\'
res = res.replace(///.[^#{pathSepRegExp}]*$///, ".#{ext}")

I prefer the second solution, which also covers a few more (theoretical)
cases.


Reply to this email directly or view it on GitHub
#588 (comment).

sourcehunter added a commit to sourcehunter/roots that referenced this issue Apr 9, 2015
jescalan pushed a commit that referenced this issue Apr 9, 2015
Fix for "Not Working In Windows #588"
@Gioni06
Copy link

Gioni06 commented Apr 28, 2015

I installed roots globally, but when i run roots new test-project it says that there is now Internet connection. Sorry i have no console output right now, buts it works fine on my mac. When i copy the files manually into a new project roots runs just fine.

@Gioni06
Copy link

Gioni06 commented Apr 28, 2015

now = no .Sorry German autocompletion.

@jescalan
Copy link
Owner Author

Hi @Gioni06 -- I need a few more details than this to be able to diagnose what's going on for you. Are you sure this is not an issue with your internet connection?

@Gioni06
Copy link

Gioni06 commented May 2, 2015

Hi @Jenius. I just wanted to let you know that its works now. I was about to reproduce the error, but i switched to Windows 10 and the error disappeared. I'm 100% sure that my connection was just fine though. I think the error was produced at a lower level, not Roots related. Sorry for the false alarm. When i can reproduce the error anytime soon, I will let you know.

@jescalan
Copy link
Owner Author

jescalan commented May 2, 2015

Cool, thanks for the update and glad it's working now!

@edinabazi
Copy link

This is the error I'm receiving on Windows. Any ideas?

@zspecza
Copy link
Contributor

zspecza commented May 21, 2015

@edinchez that looks like you need to install Git first. :)

@haxsu
Copy link

haxsu commented Jun 9, 2015

I was able to install roots on Windows but when I try to make a new project, it does this:

C:\Users\ALL INJURY CARE>roots new project
{ [Error: Command failed: C:\Windows\system32\cmd.exe /s /c "git clone https://g
ithub.com/roots-dev/base.git C:\Users\ALL INJURY CARE.config\sprout\roots-base"

Too many arguments.

usage: git clone [options] [--] [

]

-v, --verbose         be more verbose
-q, --quiet           be more quiet
--progress            force progress reporting
-n, --no-checkout     don't create a checkout
--bare                create a bare repository
--mirror              create a mirror repository (implies bare)
-l, --local           to clone from a local repository
--no-hardlinks        don't use local hardlinks, always copy
-s, --shared          setup as shared repository
--recursive           initialize submodules in the clone
--recurse-submodules  initialize submodules in the clone
--template <template-directory>
                      directory from which templates will be used
--reference <repo>    reference repository
-o, --origin <name>   use <name> instead of 'origin' to track upstream
-b, --branch <branch>
                      checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
                      path to git-upload-pack on the remote
--depth <depth>       create a shallow clone of that depth
--single-branch       clone only one branch, HEAD or --branch
--separate-git-dir <gitdir>
                      separate git dir from working tree
-c, --config <key=value>
                      set config inside the new repository

]
killed: false,
code: 129,
signal: null,
cmd: 'C:\Windows\system32\cmd.exe /s /c "git clone https://github.com/roots
-dev/base.git C:\Users\ALL INJURY CARE.config\sprout\roots-base"' }
Potentially unhandled rejection [3] Error: Command failed: C:\Windows\system32\c
md.exe /s /c "git clone https://github.com/roots-dev/base.git C:\Users\ALL INJUR
Y CARE.config\sprout\roots-base"
Too many arguments.

usage: git clone [options] [--] [

]

-v, --verbose         be more verbose
-q, --quiet           be more quiet
--progress            force progress reporting
-n, --no-checkout     don't create a checkout
--bare                create a bare repository
--mirror              create a mirror repository (implies bare)
-l, --local           to clone from a local repository
--no-hardlinks        don't use local hardlinks, always copy
-s, --shared          setup as shared repository
--recursive           initialize submodules in the clone
--recurse-submodules  initialize submodules in the clone
--template <template-directory>
                      directory from which templates will be used
--reference <repo>    reference repository
-o, --origin <name>   use <name> instead of 'origin' to track upstream
-b, --branch <branch>
                      checkout <branch> instead of the remote's HEAD
-u, --upload-pack <path>
                      path to git-upload-pack on the remote
--depth <depth>       create a shallow clone of that depth
--single-branch       clone only one branch, HEAD or --branch
--separate-git-dir <gitdir>
                      separate git dir from working tree
-c, --config <key=value>
                      set config inside the new repository

at ChildProcess.exithandler (child_process.js:751:12)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Socket. (child_process.js:1183:11)
at Socket.emit (events.js:107:17)
at Pipe.close (net.js:485:12)

I have tried everything that I could think of (including trying out the things listed on this forum) to fix this issue but now it is really bothering me. I really would like to be able to use this for Windows. Please, if anyone can help me solve this, that would be great.

@jescalan
Copy link
Owner Author

jescalan commented Jun 9, 2015

Hey @haxsu, looks like the issue is that your windows username has spaces in it that are not being escaped. Do you happen to know how spaces in paths are escaped in windows? On unix, they are prefixed by a backslash. If this is the same in windows, would be an easy fix here. Also for the future, it's a super bad idea to put spaces in your computer's username 😀

@zspecza
Copy link
Contributor

zspecza commented Jun 9, 2015

@Jenius - you can either surround the path in quotation marks (bar the file extension, if present), or escape spaces with a caret (^)

@jescalan
Copy link
Owner Author

jescalan commented Jun 9, 2015

Of course it would be that -_____________-

Welp, we know how to fix it now. I'm not going to have time to personally write the fix for this any time soon, but if anyone wants to take a crack at it I'd gladly review a PR!

@haxsu
Copy link

haxsu commented Jun 17, 2015

I can verify that renaming my computer name fixed that issue. I also had to add a path directory manually.

Now I am having the same issue that monkeez had where as when I run "roots watch" it leaves a blank screen with a red x. Trying to resolve this issue at the moment but help would be appreciated.

EDIT: Never mind, fixed the issue. It seems like when I was running roots watch, i did not actually cd to the actual project folder...lol

@ghost
Copy link

ghost commented Sep 25, 2016

@haxsu - Could you elaborate on how you fixed the issue with your Windows user name? I can't get it to work.

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

No branches or pull requests

7 participants