简体   繁体   English

错误:加载 PostCSS 插件失败:找不到模块“postcss-import”(Vue 2)

[英]Error: Loading PostCSS Plugin failed: Cannot find module 'postcss-import' (Vue 2)

I create my first npm package.我创建了我的第一个 npm package。 I published it on npmjs and encountered the error of the lack of the 'postcss-import' module after installing the package in the project and running it.我在npmjs上发布,在项目中安装package并运行后遇到了缺少'postcss-import'模块的错误。 Tell me, where and in which file may the problem be?告诉我,问题可能出在哪里,在哪个文件中? I tried all the ways and nothing works.Maybe something is wrong with these files?我尝试了所有方法,但没有任何效果。也许这些文件有问题?

This is the 'package.json' file of my package这是我的 package 的“package.json”文件

{
  "_from": "some_package",
  "_inBundle": false,
  "_integrity": "sha512-***",
  "_location": "/some_package",
  "_phantomChildren": {},
  "_requested": {
    "type": "tag",
    "registry": true,
    "raw": "some_package",
    "name": "some_package",
    "escapedName": "some_package",
    "rawSpec": "",
    "saveSpec": null,
    "fetchSpec": "latest"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/some_package/-/some_package-1.0.1.tgz",
  "_shasum": "***",
  "_spec": "some_package",
  "_where": "/home/user/vue/projects/package_name",
  "author": "",
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ],
  "bundleDependencies": false,
  "dependencies": {
    "vue": "^2.6.5",
    "vue-browser-detect-plugin": "^0.1.5",
    "vue-element-resize-event": "^0.1.0"
  },
  "deprecated": false,
  "description": "A Vue.js project",
  "devDependencies": {
    "postcss-import": "^11.0.0",
    "postcss-loader": "^2.1.6",
    "postcss-url": "^7.2.1"
  },
  "engines": {
    "node": ">= 6.0.0",
    "npm": ">= 3.0.0"
  },
  "license": "ISC",
  "main": "src/main.js",
  "name": "some_package",
  "private": false,
  "scripts": {
    "build": "node build/build.js",
    "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
    "start": "npm run dev"
  },
  "version": "1.0.8",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/user/some_package.git"
  },
  "bugs": {
    "url": "https://github.com/user/some_package/issues"
  },
  "homepage": "https://github.com/user/some_package#readme"
}

This is the '.postcssrc.js' file of my package这是我的 package 的“.postcssrc.js”文件

module.exports = {
  "plugins": {
    "postcss-import": {},
    "postcss-url": {},
    // to edit target browsers: use "browserslist" field in package.json
    "autoprefixer": {}
  }
}

You can try:你可以试试:

npm install --save-dev postcss-import

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 加载 PostCSS 插件失败:找不到模块“tailwindcss” - Loading PostCSS Plugin failed: Cannot find module 'tailwindcss' 错误:PostCSS 插件 tailwindcss 需要 PostCSS 8 - Error: PostCSS plugin tailwindcss requires PostCSS 8 错误:PostCSS 插件 postcss-mixins 需要 PostCSS 8 - Error: PostCSS plugin postcss-mixins requires PostCSS 8 当我 npm 运行开发时出现错误:找不到模块“postcss/lib/parser” - When I npm run dev I get an error: cannot find module “postcss/lib/parser” internalBinding('errors').triggerUncaughtException(^ 错误 [ERR_MODULE_NOT_FOUND]: 找不到 package 'postcss' - internalBinding('errors').triggerUncaughtException( ^ Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'postcss' 错误:PostCSS 插件自动前缀需要 PostCSS 8。更新 PostCSS 或降级此插件 - Error: PostCSS plugin autoprefixer requires PostCSS 8. Update PostCSS or downgrade this plugin Npm错误:无法加载插件导入:找不到模块&#39;../docsUrl&#39; - Npm Error: Failed to load plugin import: Cannot find module '../docsUrl' 在 npm 运行构建时出错(PostCSS 插件 postcss-purgecss 需要 PostCSS 8)vuejs3 和 tailwind - Getting error on npm run build (PostCSS plugin postcss-purgecss requires PostCSS 8) vuejs3 and tailwind NPM 发布步骤 AzureDevOps 中的构建错误:[object Object] 不是 PostCSS 插件 - BUILD ERROR in NPM release step AzureDevOps: [object Object] is not a PostCSS plugin 无法加载在“... » eslint-config-standard”中声明的插件“import”:找不到模块“eslint-plugin-import” - Failed to load plugin 'import' declared in '... » eslint-config-standard': Cannot find module 'eslint-plugin-import'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM