我使用 Laravel 5,在 Windows 命令行中输入命令 "touch storage\database.sqlite",出现以下错误信息:"touch" 不是内部或外部命令,也不是可运行的程序或批处理文件。有什么提示来解决这个问题吗?
如果您正在使用Node.js,只需使用以下命令在Windows上通过npm安装它:
npm install
npm install touch-cli -g
它将为"touch"安装命令行界面,然后您可以像在Unix中一样使用它...
touch webpack.config.ts, webpack.config.prod.ts
- 运行该命令时,只会创建一个名为 webpack.config.ts,
(即名称末尾带有逗号)的文件。 - OutstandingBill运行此命令后问题已被解决:
npm install touch-cli -g
之后我可以运行这个:
touch .babelrc
你尝试执行的命令是基于Unix / Linux的命令,因此在Windows中无法工作。
它只是更新文件的修改时间戳。
这里有另一个问题为Windows提供了一种替代方法:https://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch/764716
touch test.html.
test.html
文件。该命令适用于任何其他类型的文件。echo>
,例如path/file.sqlite
。type NUL > path/file.sqlite
,如此处所述:https://dev59.com/wXVC5IYBdhLWcg3wsTbv#295214 - eckes如果您想在ReactNative中使用TypeScript,请首先运行以下命令:
npm install touch-cli -g
然后您可以使用 touch 命令,例如:
touch rn-cli.config.js
例子:
在Windows命令提示符中输入type nul >test.html,还有另外一种方法:
echo.>test.html
两种方法都能正常工作。
我在GitHub社区中阅读了一个解决方案,对我很有效。
如果您正在使用VSCode,并且想要像Linux一样做某些事情,您可以使用git bash,它的功能相同。您可以通过以下方式将git bash添加到VSCode中:
"terminal.integrated.profiles.windows": {
"Git Bash": {
"path": "C:\\Program Files\\Git\\bin\\bash.exe"
},
},
"terminal.integrated.defaultProfile.windows": "Git Bash"
注意:请确保您已经安装了Git Bash。祝你好运!
touch
是*nix命令,而不是Windows命令。这里有一些解决方案:http://superuser.com/questions/10426/windows-equivalent-of-the-linux-command-touch/764716 - Joel Hinztype nul>example.txt
。 - AMD