0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

DjangoにTailwindを導入しようとしてつまづいた

Posted at

はじめに

DjangoにTailwindを入れたくて下記のパッケージを導入しようとしたところ、途中でエラーが出たので、解決方法を残しておきます。

環境

Static Badge
Static Badge
Static Badge
Static Badge

遭遇したエラー

インストール手順

インストール手順

上記のインストール手順の手順7実行時にエラーが出ました

エラー内容

コマンド
python manage.py tailwind install
エラー内容
CommandError: 
It looks like node.js and/or npm is not installed or cannot be found.

Visit https://nodejs.org to download and install node.js for your system.

If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system.

Example:
NPM_BIN_PATH = "/usr/local/bin/npm"

解決策

settings.pyに以下の1文を追加するだけでいいみたいです。

settings.py
+ NPM_BIN_PATH = 'npm.cmd'

そもそも公式ページに、Windowsの場合はnpmのコマンドがnpm.cmdを指している場合がある、と書いてありました...。

:point_down:このあたりに書いてありました。

公式ページまで飛ぶのが面倒くさい人向け

:point_down:抜粋

On Windows, you may have npm on $PATH but it’s npm.cmd rather than npm. (You can call it from the terminal because $PATHEXT contains .cmd.) If so, please override the default NPM_BIN_PATH = 'npm':

:point_down:翻訳

Windowsでは、npm が $PATH に登録されていても、実際には npm.cmd である場合があります(これは $PATHEXT に .cmd が含まれているため、ターミナルから呼び出せます)。その場合は、デフォルトの NPM_BIN_PATH = 'npm' を上書きしてください。

参考にしたページ

  • Githubのisse

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?