- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何在本地安装 postcss
模块,并通过全局安装的 postcss-cli
使用它们?
例如:
postcss -u autoprefixer -o style.css index.css
如果我在全局安装了 postcss-cli
和 autoprefixer
,或者两者都在本地安装,则此命令有效。但它不起作用,如果我在全局安装了 postcss-cli
,并在本地安装了 autoprefixer
。
这个问题并不特定于 autoprefixer,因为 autoprefixer 将是一个模块,无论如何我都希望在全局安装什么。任何建议都会有所帮助。
这是我得到的错误,如果 postcss-cli
全局安装,autoprefixer
本地:
> postcss -u autoprefixer -o style.css index.css -w
module.js:327
throw err;
^
Error: Cannot find module 'autoprefixer'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /home/user/.nvm/versions/node/v4.4.2/lib/node_modules/postcss-cli/index.js:104:14
at Array.map (native)
at Object.<anonymous> (/home/user/.nvm/versions/node/v4.4.2/lib/node_modules/postcss-cli/index.js:97:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
npm ERR! Linux 3.19.0-58-generic
npm ERR! argv "/home/user/.nvm/versions/node/v4.4.2/bin/node" "/home/user/.nvm/versions/node/v4.4.2/bin/npm" "run" "css"
npm ERR! node v4.4.2
npm ERR! npm v2.15.0
npm ERR! code ELIFECYCLE
npm ERR! Node.js@1.0.0 css: `postcss -u autoprefixer -o style.css index.css -w`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Node.js@1.0.0 css script 'postcss -u autoprefixer -o style.css index.css -w'.
npm ERR! This is most likely a problem with the Node.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! postcss -u autoprefixer -o style.css index.css -w
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs Node.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls Node.js
npm ERR! There is likely additional logging output above.
最佳答案
如果您使用的是 postcss-cli,您可以像这样创建一个配置文件:
{
"use": [
"postcss-import",
"postcss-cssnext",
"lost",
"rucksack-css",
"postcss-autoreset",
"postcss-font-magician"
],
"input": "src/app.css",
"output": "css/main.css",
"local-plugins": true,
"autoprefixer": {
"browsers": "last 2 versions"
}
}
注意 "local-plugins": true,
行。来自文档:
Look up plugins starting from node_modules located in the current working directory. Without this option, postcss-cli will look for the plugins in the node_modules in which it is installed - specifically if it is installed globally it will only look for plugins that are globally installed.
如果您不想使用配置文件,您可以使用选项 --local-plugins
。
总是在本地安装是个好主意。您始终可以在 package.json
中创建 NPM 脚本,以便更轻松地运行 postcss-cli
,如下所示:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "node_modules/postcss-cli/bin/postcss -c config.json",
"watch": "node_modules/postcss-cli/bin/postcss -c config.json -w",
"minify": "node_modules/postcss-cli/bin/postcss -c config-minify.json"
},
现在你只需使用:
npm run build
关于npm - postcss-cli : using locally vs globally installed postcss modules,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36509185/
int i = 1; int main() { int i = 2; { int i = 3; cout 值为 3)。您能做的最好的事情就是在它仍在范
我可以手动为某些应用程序设置 $locale 吗? 支持本地化的唯一方法是否可能是包含当前语言环境的 Angular 库中的本地化文件。如果存在多种文化怎么办?在这种情况下我必须动态加载本地化文件?我
我有两台机器。一个使用 CUPS 1.5.0,另一个使用 CUPS 1.6.1。两台机器位于同一本地网络上。我想要完全发现网络上的打印机。如果我运行以下命令: CUPS_DEBUG_LEVEL=2 /
所以我基本上是这样做的。 OObjectDatabaseTx result = OObjectDatabasePool.global().acquire( "local:orientdb", "adm
控制台日志重新显示此错误 tsega/meteor-bootstrap3-datetimepicker TypeError: locale() locale it is not loaded from
我在使用 express 4 时很困惑。我使用 express-generator 来生成我的项目。根目录下有app.js,路由器文件有index.js。但是网上关于express的教程都是直接在
问题:直接使用 SimpleDateFormat,无需明确的语言环境Id:SimpleDateFormat SimpleDateFormat format = new SimpleDateFormat
这里的代码在 Python 中,但在使用语言环境的 C/C++ 中的行为应该是相同的。 >>> import locale >>> locale.setlocale(locale.LC_ALL, "f
根据 app-localize-behavior 的 polymer 文档 Each element that displays content to be localized should add
起初我从 this tutorial 实现 l10n到 Flutter 的模板项目文件,这是成功的。之后,我尝试将 MyHomePage 类移动到名为 home.dart 的新文件中。它停止工作是因为
我正在使用源代码中的Postgres 13(Rel_13_STRATE分支),并且我使用的是来自apachea/age源代码的(Release/PG13/1.3.0分支)中的1.3.0版的Apache
我有: 基于节点Express的Web服务器,应仅在用户的本地计算机上运行 一个 Angular 客户端应用程序,它将GET Http请求发送到该本地Web服务器以获取JSON中的数据并将其显示在浏览
问了一些类似的问题,但我的问题是,如果我想传播不同路由中间件的中间结果,最好的方法是什么? app.use(f1); app.use(f2); app.use(f3); function f1(req
我注意到我的本地变量中有从服务器收到的本地变量的副本。例如 Object { settings: "4.2", env: "development", utils: true,
我的网卡不稳定,尤其是从休眠状态恢复后,有时会掉线。退出对应于Vista的网络状态,在通知区域中显示为“仅限本地”。是否可以通过编程方式检索这些状态值(例如“有限连接”,“仅本地”,“本地和Inter
你好想知道在模板中是否有一种简单的方法来访问当前翻译的 lang 字符串。 最佳答案 您可以使用 I18n.locale 访问它. 所以在 ERB 中...... ...在 HAML 中: = I1
我在 Django 中工作。在 Django 中,当您渲染模板时,您向其发送一个上下文字典以进行替换。因为我很懒/干,所以我经常使用 locals() 作为快捷方式,而不是发送看起来像 {'my_va
我一直在尝试让 Java 根据语言环境转换数字。偶遇this post这在很大程度上帮助了我预先理解这一点,我设计了自己的方法将数字转换为特定的语言环境(根据关于这个主题的其他混淆讨论) 所以假设我有
当我运行“hadoop job -status xxx”时,输出以下一些列表。 Rack-local map tasks=124 Data-local map tasks=6 Rack-local m
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 3个月前关闭。 Improve
我是一名优秀的程序员,十分优秀!