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

replace a keyword in windows cmd.exe #12

Open
eteeselink opened this issue Jan 24, 2013 · 7 comments
Open

replace a keyword in windows cmd.exe #12

eteeselink opened this issue Jan 24, 2013 · 7 comments

Comments

@eteeselink
Copy link

Hi! Lovely util. Without all the drama I would've never come across it.

Now, I tried using it on Windows, and got really weird behaviour, until I realized that there's actually a cmd.exe command called "replace". I solved it by copying .../npm/replace.cmd to .../npm/replacejs.cmd. Maybe it would be good to include that alias by default? Or, if npm allows, by default on Windows systems?

@harthur
Copy link
Owner

harthur commented Jan 25, 2013

Ooh, that's not good. Thanks for reporting this. I'll look into it.

@cod3beat
Copy link
Contributor

replace is also a keyword used by maria-db

@eteeselink
Copy link
Author

But can you run npm scripts from mariadb? i mean, maybe I'm missing something, but how is that a problem?

@cod3beat
Copy link
Contributor

What i meant was maria-db also has a command line prompt named replace. So it clashes with this replace

@farmerpaul
Copy link

I was just about to make your package a dependency on our project, as it looks like it'll be the perfect fit, but then I tried typing "replace" on my command line and found that I, too, have such an executable in my path already (it comes with MAMP for OS X). I wonder if you'd best rename your utility to something a little less likely to cause name clashes? "replace" is certainly a common word.

@wlaurance
Copy link

I have had this problem too. There are several ways to get around it.

  1. make an alias in your shell to whatever you want
  2. directly execute the node_module ./node_modules/.bin/replace
  3. fork it, change the executable name npm install username/replace --save

I'm sure there are plenty more.

@joemaller
Copy link

I'm not using it globally, but the command works perfectly in Windows cmd.exe so long as it's either called as node_modules\.bin\replace or from a script in package.json. One Windows-specific note which might trip up the unix-fluent (me): Arguments must be enclosed in double-quotes. Single-quotes do something different in the default Window CLI.

C:\Users\joe\Desktop\replacer> node_modules\.bin\replace "foo" "bar" foobar.txt

👍

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

6 participants