package.json 脚本中带有空格的应用程序路径

Kan*_*tic 5 node.js package.json

我在字符串和空格方面遇到问题。在 package.json 中创建用于运行命令的别名时(它会失败,因为在第一个空格处剪切命令)。

{
  "scripts": {
    ...
    "react-native-debugger:osx": "/Applications/React Native Debugger.app/Contents/MacOS/React Native Debugger"
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)

我需要这个,以便能够自动启动环境来开发反应本机应用程序,并且转义 using\不起作用。

Kan*_*tic 5

我不知道是否有更好的解决方案,因为解决方案但对我来说解决方案是将字符串设置为单引号中的空格 ( ')

{
  "scripts": {
    ...
    "react-native-debugger:osx": "/Applications/'React Native Debugger.app'/Contents/MacOS/'React Native Debugger'"
    ...
  }
}
Run Code Online (Sandbox Code Playgroud)