'cp' is not recognized as an internal or external command
Asked Answered
T

12

22

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\
Tweeny answered 10/2, 2013 at 11:18 Comment(1)
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"Vesicate
M
30

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.

Mansion answered 11/2, 2013 at 4:4 Comment(2)
Thanks, I've got your point, I have downloaded this 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?Tweeny
Oh the joys of Windows and its different commands 🙄Cellini
C
25

Stolen from Here :)

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

Caird answered 22/7, 2019 at 11:25 Comment(0)
S
3

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

Shrunken answered 19/11, 2019 at 19:47 Comment(0)
F
3

Change cp to copy

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

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

Fibriform answered 13/5, 2022 at 11:31 Comment(0)
C
2

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

Concavity answered 2/9, 2023 at 6:5 Comment(0)
Y
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.

Yod answered 7/6, 2013 at 10:17 Comment(0)
B
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)

Busby answered 10/2, 2020 at 17:25 Comment(0)
A
0

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

Adore answered 20/4, 2020 at 17:12 Comment(1)
Care to add an explanation to this?Drucill
C
0

If you are getting this error in Python Try:

import shutil
shutil.copy(source,target)
Chapfallen answered 28/5, 2021 at 15:49 Comment(0)
L
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.

Lilas answered 28/4, 2023 at 9:40 Comment(0)
U
0

I face similar issues while using windows the changes I make change "cp" to "copy"

and all the "/" in the direcotry I change it to the "\"

in your case

your command => -cmd cp -R assets bin\js
update command for windows => -cmd copy -R assets bin\js

Uptrend answered 16/9, 2023 at 5:15 Comment(1)
Thank you for your interest in contributing to the Stack Overflow community. This question already has quite a few answers—including one that has been extensively validated by the community. Are you certain your approach hasn’t been given previously? If so, it would be useful to explain how your approach is different, under what circumstances your approach might be preferred, and/or why you think the previous answers aren’t sufficient. Can you kindly edit your answer to offer an explanation?Anglonorman
S
-1

Using the xcopy command works.

Stanislas answered 19/4, 2014 at 5:24 Comment(1)
Please do provide an example of how the xcopy command works; sample codeCrelin

© 2022 - 2024 — McMap. All rights reserved.