Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8883

npm runでコマンドを実行する場合とターミナルで実行する場合の違い【初心者向け】

$
0
0
typescriptをインストールして比べてみる ターミナルで実行する場合(グローバルインストール) 適当にnpmプロジェクトを作成します。 mkdir npm_project cd npm_project npm init ここで、typescriptをグローバルインストールします。 npm install -g typescript which tsc /mnt/c/Program Files (x86)/Nodist/bin/tsc とコマンドを打つと、パスが通っていればグローバルインストールしたtscへのパスが表示されます。(WSL環境のパスです) npm run で実行する場合(ローカルインストール) ~/npm_project npm install typescript package.jsonのscriptを編集します。 package.json "scripts": { "tsc": "which tsc" } npm runでコマンドを実行します ~/npm_project npm run tsc /mnt/c/Users/mano-syou/Desktop/qiita_ts/node_modules/.bin/tsc プロジェクト配下のnode_modules内にローカルインストールしたtscへのパスが表示されます。

Viewing all articles
Browse latest Browse all 8883

Trending Articles