【问题标题】:PostCSS with Gulp throws an error after update使用 Gulp 的 PostCSS 更新后抛出错误
【发布时间】:2017-10-12 14:00:33
【问题描述】:

我使用 ncu 更新了 npm 包(npm 检查更新)。更新所有包后,构建过程抛出错误。

完成我的 gulp 任务并删除一个名为“Precss”的 PostCSS 插件后,一切正常。我还尝试将这个插件单独恢复到旧版本,它可以工作。

不幸的是 Precss 是我需要的主要插件,以便在我的 CSS 中使用类似 SASS 的功能。此插件必须是最新版本,因为另一个名为 postcss-calc 的插件依赖于 Precss 插件。

下面是抛出的错误:

Node#before is deprecated. Use Node#raws.before
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 7): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 9): TypeError: Cannot set property 'parent' of undefined
(node:8447) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 10): TypeError: Cannot set property 'parent' of undefined

【问题讨论】:

    标签: node.js gulp postcss


    【解决方案1】:

    我刚刚遇到了同样的问题,通过修复我的 package.json 中的依赖关系而不是使用“最新”版本来解决......

    有我的模块版本,希望对你有帮助:

    $ npm list --depth=0
    ├── autoprefixer@6.7.7
    ├── browser-sync@2.18.11
    ├── gulp@3.9.1
    ├── gulp-autoprefixer@3.1.1
    ├── gulp-clean@0.3.2
    ├── gulp-concat@2.6.1
    ├── gulp-concat-css@2.3.0
    ├── gulp-cssbeautify@0.1.3
    ├── gulp-cssnano@2.1.2
    ├── gulp-csso@3.0.0
    ├── gulp-load-plugins@1.5.0
    ├── gulp-notify@2.2.0
    ├── gulp-plumber@1.1.0
    ├── gulp-postcss@6.4.0
    ├── gulp-rename@1.2.2
    ├── gulp-sourcemaps@2.4.1
    ├── postcss-sorting@2.0.1
    └── precss@1.4.0
    

    【讨论】:

      猜你喜欢
      • 2016-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多