Postcss-cli 找不到 flexbugs-fixes 模块(但找到 autoprefixer 没有问题)

rak*_*tin 5 node.js node-sass postcss

我通过 npm 在我的项目中安装了 postcss-cli autoprefixer 和 postcss-flexbugs-fixes 。pff 有未满足的 dep 警告,但它确实安装了。我知道我的 postcss 和 cli 正在工作,因为当我运行时

postcss --use autoprefixer index.scss
Run Code Online (Sandbox Code Playgroud)

从终端它工作得很好 - 我有一些虚拟的 css 在那里无论如何只是为了排除语法错误。

当我跑步时

postcss --use postcss-flexbugs-fixes index.scss
Run Code Online (Sandbox Code Playgroud)

我收到一条错误消息,指出找不到模块 postcss-flexbugs-fixes。可能值得一提的是,我使用的是 Node 4.4.5,但我之前已经在这个版本的 Node 上进行过 postcss-flexbugs-fixes 工作,唯一的区别(包括版本号)是它被包装在 gulp 任务中。这是完整的错误:

Error: Cannot find module 'postcss-flexbugs-fixes'
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 /Users/ohu275/.nvm/versions/node/v4.4.5/lib/node_modules/postcss-cli/index.js:107:14
at Array.map (native)
at Object.<anonymous> (/Users/ohu275/.nvm/versions/node/v4.4.5/lib/node_modules/postcss-cli/index.js:100:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
Run Code Online (Sandbox Code Playgroud)

我最终试图达到可以通过 npm 构建脚本运行 postcss 任务的地步。我已经有了 autoprefixer 工作,但没有通过 postcss-cli 进行 flexbugs-fixes。我必须认为我做错了什么,因为我之前已经使用过这个特定的插件,只是没有使用 cli。其他插件正在与我的 cli 配合使用。任何帮助将非常感激。

Ain*_*riu 11

npm install -D postcss-flexbugs-fixes  
Run Code Online (Sandbox Code Playgroud)

npm install -D postcss-preset-env   
Run Code Online (Sandbox Code Playgroud)

  • 就我而言,我两者都需要。 (2认同)