LoginSignup
10
9

More than 3 years have passed since last update.

MacのAutomatorでnpmコマンドを使う

Last updated at Posted at 2019-10-03

自動ビルドはCIに組み込むのが一般的だが、一時的にローカルで検証用のenvファイルに差し替えてビルドしたいときがあったりする。

何が問題か?

Automatorでシェルスクリプトを使えるシェルスクリプトを実行アクションの実行環境はターミナルの環境依存を継承しないためnpmコマンドをそのまま使うことがでず、npm command not foundエラーが発生する。つまりパスが通っていない状態。

解決法

最初にnpmへのパスを通すためにシェルスクリプトを実行アクションのシェルウィンドウに以下を入力。
1行目でパスを通した後はnpmコマンドを実行できる。

export PATH=$PATH:/usr/local/bin
cd myProjectDir
npm run build
10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9