17

I tried to run a project using custom build in FlashDevelop:

$(CompilerPath)\haxe.exe $(ProjectDir)\compile-js.hxml

, but I get this error:

'cp' is not recognized as an internal or external command,

here is the compile-js.hxml file, is there any idea how to solve this?

compile-js.hxml

#sources
-main Cocktail
-cp ../../src/
-cp src

#binary
-js bin/js/Main.js
--macro Cocktail.create('src/index.html','Main')

#copy assets directory
-cmd cp -R assets bin\js\
simo
  • 23,342
  • 38
  • 121
  • 218
  • It worked for me this wayl i changed frm this--> `"cp ./data/orig-db.json ./data/db.json && json-server --watch ./data/db.json"` to this-->`"copy .\\data\\orig-db.json .\\data\\db.json && json-server --watch .\\data\\db.json"` – Arpan Banerjee Jul 06 '20 at 10:06

11 Answers11

25

I'm guessing if you're on Flashdevelop, you're running Windows, and if you're running windows, there's no such thing as the 'cp' command. When haxe has finished building your Javascript, it gets to the -cmd line and attempts to run cp -R assets bin\js\, which will fail because windows doesn't have cp, it has copy.

For Windows, try changing the last two lines to something like:

#copy assets directory
-cmd copy \y assets bin\js\

** Disclaimer: I'm not in Windows at the moment, so am not certain about the exact syntax of the Copy command. But you get the idea.

mdowes
  • 592
  • 7
  • 18
Jason O'Neil
  • 5,908
  • 2
  • 27
  • 26
  • Thanks, I've got your point, I have downloaded this https://github.com/bmatzelle/gow to run linux commands, and I have added an environment path to its bit folder: C:\Program Files (x86)\Gow\bin which contains linux commands in form of exe files But I still have the error: 'cp' is not recognized as an internal or external command, I hope I can fix this, how can I benefit from gow above? – simo Feb 11 '13 at 06:54
  • Oh the joys of Windows and its different commands – Captain Jack Sparrow May 28 '21 at 15:57
21

Stolen from Here :)

if you're running on windows you have to replace "cp" with "copy"

Vineesh TP
  • 7,755
  • 12
  • 66
  • 130
3

in my case I was using windows default command prompt to install a node package. I used GitBash Shell and Yahoo......

ImFarhad
  • 2,669
  • 2
  • 18
  • 30
3

Change cp to copy

For example: I was trying this cp -a themes/hugo-curious/exampleSite/* .

Change to copy themes\\hugo-curious\\exampleSite\\* .

Mwongera808
  • 880
  • 11
  • 16
0

if you have cygwin installed in the Windows Box, or using UNIX Shell then

Issue bash#which cp

This will tell you whether cp is in your classpath or NOT.

anish
  • 6,884
  • 13
  • 74
  • 140
0

Are you running on Windows cmd, then follow this. It worked for me !

webpack -d && copy src\index.html dist\index.html && webpack-dev-server --content-base src --inline --hot

Found here: https://github.com/mschwarzmueller/reactjs-basics/issues/2#issuecomment-274776347 (thanks to medigvijay)

0

copy node_modules\laravel-mix\setup\webpack.mix.js .\

0

If you are getting this error in Python Try:

import shutil
shutil.copy(source,target)
0

git bash worked for me. try executing the command in git bash.

i ran the command in normal command window and execution failed, then i tried with git bash and executed successfully.

Ragu
  • 51
  • 4
0

if you are using windows, try the same in git bash, worked for me

Karthikeyan VK
  • 5,310
  • 3
  • 37
  • 50
-1

Using the xcopy command works.

Shrey Gupta
  • 5,509
  • 8
  • 45
  • 71
Tamanna Iruu
  • 191
  • 3
  • 4
  • 12