簡體   English   中英

如何在npm腳本中執行以下bash語句?

[英]How to execute the following bash statement in npm script?

我知道有很多方法可以做到這一點,但是我正在使用“ npm腳本”作為構建工具。 我被困在這個簡單的echo語句中,它將我的.bash_plugin source到.bash_profile中:

  "scripts": {
    "info": "echo 'npm as a build tool'",
    "installBashPlugin": "echo 'source ~/.bash_plugins/.my_plugin' >> '~/.bash_profile'"

我在這里做錯了什么? 我收到以下錯誤:

npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the buildtool@1.0.0 bash script 'echo 'source ~/.bash_plugins/.my_plugin' >> '~/.bash_profile''.

哦,我明白了。

"scripts": {
    "info": "echo 'npm as a build tool'",
    "installBashPlugin": "echo 'source ~/.bash_plugins/.my_plugin' >> ~/.bash_profile"

目標文件: .bash_profile周圍的那些單引號引起了錯誤。 謝謝。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM