简体   繁体   中英

Package.json script cannot find newly created folder - Windows 10

In my Angular app I try to create a dist folder with scripts in it while index.html is placed in the root folder. This is possible with some flag options. I try to automate this by adding it to my package.json scripts but my syntax seems to be incomplete or wrong.

The first halve of the script works fine but the second one doesn't. When I execute the move script separately it works fine. How can I fix my syntax so the move script runs as well?

Current script: "build:prod": "ng build --prod --output-path=\\"dist/scripts\\" --deployUrl=\\"scripts/\\" && move ./dist/scripts/index.html ./dist"

My dev environment is on Windows 10

Found the answer! I was not escaping the / correctly. Below the fully working script.

"build:prod": "ng build --prod --output-path=\"dist/scripts\" --deployUrl=\"scripts/\" && mv ./dist/scripts/index.html || move .\\dist\\scripts\\index.html .\\dist\\"

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