简体   繁体   中英

Path to application with spaces in package.json script

I am having problems with strings and spaces. when creating an alias for running a command in package.json (it fails becase cuts the command at the first space).

{
  "scripts": {
    ...
    "react-native-debugger:osx": "/Applications/React Native Debugger.app/Contents/MacOS/React Native Debugger"
    ...
  }
}

I require this, to be able to automate starting the environment to develop react native apps, and escaping using \\ does not work.

I dont know if there is a better solution because the solution but the solution for me was to set the strings with spaces in single quotes ( ' )

{
  "scripts": {
    ...
    "react-native-debugger:osx": "/Applications/'React Native Debugger.app'/Contents/MacOS/'React Native Debugger'"
    ...
  }
}
  "scripts": {
    "test": ".\\\"node modules\"\\.bin\\\"some folder\"\\protractor conf.js"
  },

use back slash and double quotes for windows.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM