繁体   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