【问题标题】:'cp' is not recognized as an internal or external command'cp' 未被识别为内部或外部命令
【发布时间】:2013-01-25 16:03:21
【问题描述】:

我尝试在 FlashDevelop 中使用自定义构建运行一个项目:

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

,但我收到此错误:

'cp' 未被识别为内部或外部命令,

这里是compile-js.hxml文件,有什么办法解决这个问题吗?

编译-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\

【问题讨论】:

  • 它对我有用,我从这个--> "cp ./data/orig-db.json ./data/db.json && json-server --watch ./data/db.json" 到这个-->"copy .\\data\\orig-db.json .\\data\\db.json && json-server --watch .\\data\\db.json"

标签: flashdevelop haxe nme


【解决方案1】:

我猜如果你在 Flashdevelop 上,你在运行 Windows,如果你在运行 Windows,没有“cp”命令之类的东西。当 haxe 完成构建 Javascript 后,它会到达 -cmd 行并尝试运行 cp -R assets bin\js\,这将失败,因为 windows 没有 cp,它有 copy

对于 Windows,请尝试将最后两行更改为:

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

** 免责声明:我目前不在 Windows 中,因此不确定 Copy 命令的确切语法。但你明白了。

【讨论】:

  • 谢谢,我明白你的意思了,我已经下载了这个github.com/bmatzelle/gow 来运行linux命令,并且我已经在它的位文件夹中添加了一个环境路径:C:\Program Files (x86)\ Gow\bin 其中包含 exe 文件形式的 linux 命令但我仍然有错误:'cp' is not Recognized as an internal or external command,我希望我能解决这个问题,我如何从上面的 gow 中受益?
  • 哦,Windows 的乐趣及其不同的命令?
【解决方案2】:

如果您在 Python 中遇到此错误 试试:

import shutil
shutil.copy(source,target)

【讨论】:

    【解决方案3】:

    复制 node_modules\laravel-mix\setup\webpack.mix.js .\

    【讨论】:

    • 想对此添加解释吗?
    【解决方案4】:

    Stolen from Here :)

    如果您在 Windows 上运行,则必须将“cp”替换为“copy”

    【讨论】:

      【解决方案5】:

      您是否在 Windows cmd 上运行,然后按照此操作。 它对我有用!

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

      在这里找到:https://github.com/mschwarzmueller/reactjs-basics/issues/2#issuecomment-274776347(感谢medigvijay

      【讨论】:

        【解决方案6】:

        在我的情况下,我使用 Windows 默认命令提示符来安装节点包。我使用了GitBash ShellYahoo.....

        【讨论】:

          【解决方案7】:

          使用xcopy 命令有效。

          【讨论】:

          • 请提供 xcopy 命令如何工作的示例;示例代码
          【解决方案8】:

          如果你在 Windows Box 中安装了 cygwin,或者使用 UNIX Shell,那么

          Issue bash#which cp
          

          这会告诉你 cp 是否在你的类路径中。

          【讨论】:

            猜你喜欢
            • 2019-03-25
            • 1970-01-01
            • 2014-04-29
            • 1970-01-01
            • 1970-01-01
            • 2013-10-06
            • 2013-10-11
            • 2016-10-01
            • 2022-01-22
            相关资源
            最近更新 更多