Search code examples
npmstatic

The syntax of the command is incorrect


I am trying to run npm start and one of the scripts are

"build:mkdir": "mkdir -p build/js && mkdir -p build/js/vendor",

then i get this error

The syntax of the command is incorrect.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! margo-static@1.0.0 build:mkdir: `mkdir -p build/js && mkdir -p build/js/vendor`
npm ERR! Exit status 1
npm ERR!

any suggestion? my platform is windows 10 , node version 12.15.0


Solution

  • I know it has been long time but I was checking my questions for this one I think modify the script will solve it

    {
    
    
    "scripts": {
        "build:mkdir": "mkdirp build/js && mkdirp build/js/vendor"
      },
      "devDependencies": {
        "mkdirp": "^0.5.5"
      }
    }
    

    as the environment is windows The -p option with mkdir command is not recognized by Windows command line and also don't forget to install mkdirp package

    npm install --save-dev mkdirp