Say, we have a React app, and there's a script in package.json:
"scripts": {
"create-images-dir": "mkdir -p distrib/images"
}
If to run this script via npm run create-images-dir
on Linux, it works fine. But trying to run it on Windows environment in git-bash or Cygwin terminal, I'm getting this error:
The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Exit status 1
Same error with setting --parents
instead of -p
. Without -p
parameter, it works, so it stumbles on -p
. But at the same time, the command from script works fine if typed manually in terminal:
mkdir -p distrib/images
For me, it looks like some symbol escaping occurs when command is translated from script to execution, or different processing of nested directories on Windows, but I have no idea what exactly it is. Am I doing something wrong?
这就是存在mkdirp软件包的原因-将其添加为dev依赖项,并在脚本中使用二进制mkdirp
而不是平台特定的mkdir
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.