0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

npmコマンドが使えず四苦八苦した件

Posted at

Docker+JavaScriptでWebアプリケーションを開発開始(Windows11)✨️

しかし、Tailwind CSSが効いていない以前に
npmコマンドが使えない状態だと判明😅

まずNode.jsのLTS版をインストールしたが

node --version

は効くが

npm --version

だけなぜか効かない

PATHにnodojsディレクトリを追加し、PC再起動してもやはりダメ

LTSを管理者権限でインストールしていないのが
原因ではないかということで
管理者権限のPowershellで下記を実行

msiexec /i "node-v22.18.0-x64.msi"

ここからPCを再起動したがやはりダメ😓

どうしようもないのでnpmファイルを直接叩いてみる

& "C:\Program Files\nodejs\npm.cmd" --version
10.9.3

なんと動いた
これによって
PowerShellの実行ポリシーの問題であることが判明

PowerShellの実行ポリシーを変更

# 管理者権限のPowerShellで実行
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

確認

# 実行ポリシーの確認
Get-ExecutionPolicy
RemoteSigned

# npmコマンドのテスト
npm --version
10.9.3

やっと動きました💫

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?