尝试缩小 tailwindcss 时出现错误消息

Posted

技术标签:

【中文标题】尝试缩小 tailwindcss 时出现错误消息【英文标题】:Error message when trying to minify tailwindcss 【发布时间】:2021-04-14 01:27:03 【问题描述】:

为了缩小我的 tailwindCSS,我尝试在我的 package.json 中创建一个脚本:

"tw:prod":"NODE_ENV=production npx tailwindcss-cli@latest build ./src/css/tailwind.css -o ./public/css/tailwind.css",

但它给出了这个错误:

> 'NODE_ENV' is not recognized as an internal or external command,
> operable program or batch file. npm ERR! code ELIFECYCLE npm ERR!
> errno 1 npm ERR! ntwport@1.0.0 tw:prod: `NODE_ENV=production npx
> tailwindcss-cli@latest build ./src/css/tailwind.css -o
> ./public/css/tailwind.css` npm ERR! Exit status 1 npm ERR! npm ERR!
> Failed at the ntwport@1.0.0 tw:prod script. npm ERR! This is probably
> not a problem with npm. There is likely additional logging output
> above.
> 
> npm ERR! A complete log of this run can be found in: npm ERR!    
> C:\Users\gabri\AppData\Roaming\npm-cache\_logs\2021-01-08T10_21_19_799Z-debug.log

该脚本是在tailwincss的文档中找到的,为什么会出现这个错误?

【问题讨论】:

嗨,蒂米,欢迎来到社区。可以在这里解决您的问题吗? (可能是因为我注意到您使用的是 Windows)***.com/questions/11928013/… @tommygun 我想是的,谢谢 这能回答你的问题吗? "NODE_ENV" is not recognized as an internal or external command, operable command or batch file 【参考方案1】:

如果你运行的是windows系统,你需要安装win-node-env dev依赖。然后你运行 tw:prod:

npm install win-node-env

【讨论】:

以上是关于尝试缩小 tailwindcss 时出现错误消息的主要内容,如果未能解决你的问题,请参考以下文章

尝试在 ProGuard 中启用缩小时出现 DexGuard 错误

调用 Unity Animator.Play() 时出现错误消息:层 -1 无效?

在 Google Colab 上执行任何单元格时出现浏览器弹出消息错误

启用 proguard 时出现杰克逊错误(缩小)

尝试使用 twilio Api phpSDK 发送消息时出现致命错误

尝试更改出价策略时出现 Google Ads 错误消息