我正在Windows上使用django-tailwind,并且正在按照安装步骤进行操作。当前步骤是使用python manage.py tailwind start
“以开发模式启动顺风”。这总是失败,并且以下文本块是生成的日志文件:
...
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle django_tailwind@~prestart: django_tailwind@
6 info lifecycle django_tailwind@~start: django_tailwind@
7 verbose lifecycle django_tailwind@~start: unsafe-perm in lifecycle true
8 verbose lifecycle django_tailwind@~start: PATH: C:\Users\jpyth\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;c:\Users\jpyth\Django\hhs-robotics-website\theme\static_src\node_modules\.bin;C:\Users\jpyth\Django\hhs-robotics-website\venv\Scripts;C:\ActiveTcl\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\jpyth\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\jpyth\AppData\Local\Programs\Python\Python37\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\GCL-2.6.1\bin\;C:\ccl\launcher;C:\Program Files (x86)\ffmpeg\bin;C:\opencv\sources\3rdparty\ffmpeg\;C:\Users\jpyth\AppData\Local\Programs\Python\Python37\Scripts\;C:\ActiveTcl\bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files (x86)\Razer Chroma SDK\bin;C:\Program Files\Razer Chroma SDK\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\jpyth\AppData\Local\Microsoft\WindowsApps;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\jpyth\AppData\Local\Programs\Python\Python37\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\GCL-2.6.1\bin\;C:\ccl\launcher;C:;C:\Users\jpyth\AppData\Local\Programs\Microsoft VS Code\bin
9 verbose lifecycle django_tailwind@~start: CWD: c:\Users\jpyth\Django\hhs-robotics-website\theme\static_src
10 silly lifecycle django_tailwind@~start: Args: [ '/d /s /c', "watch 'npm run build-postcss' ./src" ]
11 silly lifecycle django_tailwind@~start: Returned: code: 1 signal: null
12 info lifecycle django_tailwind@~start: Failed to exec start script
13 verbose stack Error: django_tailwind@ start: `watch 'npm run build-postcss' ./src`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\jpyth\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\jpyth\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid django_tailwind@
15 verbose cwd c:\Users\jpyth\Django\hhs-robotics-website\theme\static_src
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jpyth\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v12.13.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error django_tailwind@ start: `watch 'npm run build-postcss' ./src`
22 error Exit status 1
23 error Failed at the django_tailwind@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
我注意到的一件事是它失败的命令使用watch
,这不是Windows命令。但是,我确实尝试将输入运行到watch
(npm run build-postcss
),但无济于事。我什至创建了一个自定义watch.bat
脚本,该脚本已添加到PATH,但仍然失败。我不知道从这里去哪里。如何在我的Django应用中使用顺风工作的CSS?
答案 0 :(得分:3)
对不起,这很晚才在昨天遇到相同的问题,并且遇到了您的问题,但这是解决方法,因为我们使用的是窗口,我们必须进行更改
我们使用的qoutes
在./theme/static_src/package.json中更改
"start": "watch 'npm run build-postcss' ./src"
到
"start": "watch \"npm run build-postcss\" ./src"
答案 1 :(得分:1)
由于package.json中的 2020年5月14日发生了更改,从而更改了启动命令,因此上述答案不再有效。 (see the change here) 因此,出现了另一个问题。为了解决这个问题,您必须在theme / static_src / package.json中更改以下内容:
"dev": "watch 'npm run dev:sass && npm run dev:postcss' ./src",
到
"dev": "watch \"npm run dev:sass && npm run dev:postcss\" ./src",
希望这会有所帮助!