./node_modules/imagemagick/imagemagick.js中的错误找不到模块:错误:无法解析'child_process'

时间:2019-10-18 13:43:32

标签: javascript node.js webpack imagemagick react-boilerplate

我正在尝试启动一个使用react样板和cordova构建的应用程序,在完成npm安装后,该应用程序在这一点上会中断:


Building the Webpack DLL...
Hash: e9530f471c1146cf2a47
Version: webpack 3.5.5
Time: 4218ms
                      Asset     Size  Chunks                    Chunk Names
reactBoilerplateDeps.dll.js    22 MB       0  [emitted]  [big]  reactBoilerplateDeps
                     mcs.js   181 kB          [emitted]
                 mcs.min.js  64.4 kB          [emitted]
chunk    {0} reactBoilerplateDeps.dll.js (reactBoilerplateDeps) 4.73 MB [entry] [rendered]

WARNING in ./node_modules/colors/colors.js
219:30-44 Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/moment/src/lib/locale/locales.js
Module not found: Error: Can't resolve './locale' in 'C:\Projects\myproject\node_modules\moment\src\lib\locale'
 @ ./node_modules/moment/src/lib/locale/locales.js 56:12-46
 @ ./node_modules/moment/src/lib/create/from-anything.js
 @ ./node_modules/moment/src/lib/create/local.js
 @ ./node_modules/moment/src/lib/units/week.js
 @ ./node_modules/moment/src/lib/units/units.js
 @ ./node_modules/moment/src/moment.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/imagemagick/imagemagick.js
Module not found: Error: Can't resolve 'child_process' in 'C:\Projects\myproject\node_modules\imagemagick'
 @ ./node_modules/imagemagick/imagemagick.js 1:16-40
 @ ./node_modules/splashicon-generator/index.js
 @ dll reactBoilerplateDeps

package.json:

{
  "name": "myapp",
  "version": "1.1.1",
  "description": "",
  "repository": {
    "type": "git",
    "url": "git://github.com/react-boilerplate/react-boilerplate.git"
  },
  "engines": {
    "npm": ">=3",
    "node": ">=5"
  },
  "license": "MIT",
  "scripts": {
    "analyze:clean": "rimraf stats.json",
    "preanalyze": "npm run analyze:clean",
    "analyze": "node ./internals/scripts/analyze.js",
    "extract-intl": "babel-node --presets env,stage-0 -- ./internals/scripts/extract-intl.js",
    "npmcheckversion": "node ./internals/scripts/npmcheckversion.js",
    "preinstall": "npm run npmcheckversion",
    "postinstall": "npm run build:dll",
    "prebuild": "npm run build:clean",
    "build": "npm run build:fonts && npm run build:app",
    "build:app": "cross-env NODE_ENV=production webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
    "build:app:stage": "cross-env NODE_ENV=production MCS_ENV=test webpack --config internals/webpack/webpack.prod.babel.js --color -p --progress --hide-modules --display-optimization-bailout",
    "build:clean": "rimraf ./build",
    "build:dll": "node ./internals/scripts/dependencies.js",
    "build:fonts": "node ./internals/scripts/font-generator/index.js",
    "cordova:resources": "splashicon-generator --imagespath=res/source && npm run cordova:resources:prune",
    "cordova:resources:prune": "rimraf ./res/icons/windows && rimraf ./res/icons/wp8 && rimraf ./res/screens/windows && rimraf ./res/screens/wp8 && rimraf ./store && rimraf ./icon.png",
    "cordova:copy": "cpr ./build ./www --delete-first",
    "cordova:setup": "npm run build && npm run cordova:copy",
    "cordova:build:android": "npm run cordova:setup && cordova build android",
    "cordova:run:android": "npm run cordova:setup && cordova run android",
    "cordova:build:ios": "npm run cordova:setup && cordova build ios",
    "cordova:run:ios": "npm run cordova:setup && cordova run ios",
    "cordova:run:ios:stage": "cross-env MCS_ENV=test npm run cordova:setup && cordova run ios",
    "cordova:build:stage": "cross-env MCS_ENV=test npm run cordova:setup && cordova build android && cordova build ios",
    "cordova:run": "npm run cordova:setup && cordova run android && cordova run ios",
    "cordova:release:dev": "npm run cordova:setup && cordova build android && cordova build ios && npm run open:releases",
    "open:xcode": "open platforms/ios/myproject.xcworkspace",
    "open:releases": "open platforms/android/build/outputs/apk/ && open platforms/ios/build/device/",
    "start": "cross-env NODE_ENV=development node server",
    "start:tunnel": "cross-env NODE_ENV=development ENABLE_TUNNEL=true node server",
    "start:production": "npm run test && npm run build && npm run start:prod",
    "start:prod": "cross-env NODE_ENV=production node server",
    "start:stage": "cross-env NODE_ENV=development MCS_ENV=test node server",
    "presetup": "npm i chalk shelljs",
    "setup": "node ./internals/scripts/setup.js",
    "postsetup": "npm run build:dll",
    "clean": "shjs ./internals/scripts/clean.js",
    "clean:all": "npm run analyze:clean && npm run test:clean && npm run build:clean",
    "generate": "plop --plopfile internals/generators/index.js",
    "lint": "npm run lint:js",
    "lint:fix": "npm run lint:js -- --fix",
    "lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern storybook-static --ignore-pattern vendor/ --ignore-pattern internals/scripts",
    "lint:js": "npm run lint:eslint -- . ",
    "lint:staged": "lint-staged",
    "pretest": "npm run test:clean && npm run lint",
    "test:clean": "rimraf ./coverage",
    "test": "cross-env NODE_ENV=test jest --coverage",
    "test:watch": "cross-env NODE_ENV=test jest --watchAll",
    "coveralls": "cat ./coverage/lcov.info | coveralls",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook"
  },
  "lint-staged": {
    "*.js": "lint:eslint"
  },
  "pre-commit": "lint:staged",
  "babel": {
    "plugins": [
      "styled-components"
    ],
    "presets": [
      [
        "env",
        {
          "modules": false
        }
      ],
      "react",
      "stage-0"
    ],
    "env": {
      "production": {
        "only": [
          "app"
        ],
        "plugins": [
          "transform-react-remove-prop-types",
          "transform-react-constant-elements",
          "transform-react-inline-elements"
        ]
      },
      "test": {
        "plugins": [
          "transform-es2015-modules-commonjs",
          "dynamic-import-node"
        ]
      }
    }
  },
  "eslintConfig": {
    "parser": "babel-eslint",
    "extends": "airbnb",
    "env": {
      "browser": true,
      "node": true,
      "jest": true,
      "es6": true
    },
    "plugins": [
      "redux-saga",
      "react",
      "jsx-a11y"
    ],
    "parserOptions": {
      "ecmaVersion": 6,
      "sourceType": "module",
      "ecmaFeatures": {
        "jsx": true
      }
    },
    "rules": {
      "arrow-parens": [
        "error",
        "always"
      ],
      "arrow-body-style": [
        2,
        "as-needed"
      ],
      "class-methods-use-this": 0,
      "comma-dangle": [
        2,
        "always-multiline"
      ],
      "import/imports-first": 0,
      "import/newline-after-import": 0,
      "import/no-dynamic-require": 0,
      "import/no-extraneous-dependencies": 0,
      "import/no-named-as-default": 0,
      "import/no-unresolved": 2,
      "import/no-webpack-loader-syntax": 0,
      "import/prefer-default-export": 0,
      "indent": [
        2,
        2,
        {
          "SwitchCase": 1
        }
      ],
      "jsx-a11y/aria-props": 2,
      "jsx-a11y/heading-has-content": 0,
      "jsx-a11y/href-no-hash": 2,
      "jsx-a11y/label-has-for": 2,
      "jsx-a11y/mouse-events-have-key-events": 2,
      "jsx-a11y/role-has-required-aria-props": 2,
      "jsx-a11y/role-supports-aria-props": 2,
      "max-len": 0,
      "newline-per-chained-call": 0,
      "no-confusing-arrow": 0,
      "no-console": 1,
      "no-underscore-dangle": 0,
      "no-use-before-define": 0,
      "prefer-template": 2,
      "react/forbid-prop-types": 0,
      "react/jsx-first-prop-new-line": [
        2,
        "multiline"
      ],
      "react/jsx-filename-extension": 0,
      "react/jsx-no-target-blank": 0,
      "react/require-default-props": 0,
      "react/require-extension": 0,
      "react/self-closing-comp": 0,
      "redux-saga/no-yield-in-race": 2,
      "redux-saga/yield-effects": 2,
      "require-yield": 0
    },
    "settings": {
      "import/resolver": {
        "webpack": {
          "config": "./internals/webpack/webpack.prod.babel.js"
        }
      }
    }
  },
  "dllPlugin": {
    "path": "node_modules/react-boilerplate-dlls",
    "exclude": [
      "chalk",
      "compression",
      "cross-env",
      "express",
      "ip",
      "minimist",
      "sanitize.css"
    ],
    "include": [
      "core-js",
      "lodash",
      "eventsource-polyfill"
    ]
  },
  "jest": {
    "snapshotSerializers": [
      "enzyme-to-json/serializer"
    ],
    "setupFiles": [
      "./test/jestsetup.js"
    ],
    "collectCoverageFrom": [
      "app/**/*.{js,jsx}",
      "!app/**/*.test.{js,jsx}",
      "!app/*/RbGenerated*/*.{js,jsx}",
      "!app/app.js",
      "!app/global-styles.js",
      "!app/*/*/Loadable.{js,jsx}"
    ],
    "coverageThreshold": {
      "global": {
        "statements": 98,
        "branches": 91,
        "functions": 98,
        "lines": 98
      }
    },
    "moduleDirectories": [
      "node_modules",
      "app"
    ],
    "moduleNameMapper": {
      ".*\\.(css|less|styl|scss|sass)$": "<rootDir>/internals/mocks/cssModule.js",
      ".*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/internals/mocks/image.js"
    },
    "setupTestFrameworkScriptFile": "<rootDir>/internals/testing/test-bundler.js",
    "testRegex": "tests/.*\\.test\\.js$"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "babel-polyfill": "6.23.0",
    "chalk": "1.1.3",
    "co": "^4.6.0",
    "compare-versions": "^3.3.0",
    "compression": "1.6.2",
    "cordova": "^8.0.0",
    "cordova-android": "^6.3.0",
    "cordova-ios": "^4.5.4",
    "cordova-plugin-calendar": "^5.1.2",
    "cordova-plugin-camera": "^4.0.3",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-firebase": "^1.0.5",
    "cordova-plugin-inappbrowser": "^2.0.2",
    "cordova-plugin-statusbar": "^2.4.1",
    "cordova-plugin-vibration": "^3.0.1",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.0",
    "cordova-universal-links-plugin": "^1.2.1",
    "cpr": "^2.2.0",
    "cross-env": "5.0.0",
    "dotenv": "^4.0.0",
    "es6-promise-plugin": "^4.2.2",
    "express": "4.15.3",
    "fastclick": "git://github.com/mantovanig/fastclick.git#27ab5a5870972fff56c7090ce6986a57d969cd85",
    "fontfaceobserver": "2.0.9",
    "history": "4.6.3",
    "hoist-non-react-statics": "2.1.1",
    "immutable": "3.8.1",
    "intl": "1.2.5",
    "invariant": "2.2.2",
    "ip": "1.1.5",
    "lodash": "^4.17.4",
    "minimist": "1.2.0",
    "moment": "^2.19.1",
    "prop-types": "15.5.10",
    "qrcode.react": "^0.8.0",
    "react": "15.6.1",
    "react-animate-height": "^0.10.9",
    "react-beautiful-dnd": "^6.0.0",
    "react-dom": "15.6.1",
    "react-helmet": "5.1.3",
    "react-infinite-scroller": "^1.1.4",
    "react-intl": "2.3.0",
    "react-loadable": "4.0.3",
    "react-modal": "^3.1.10",
    "react-placeholder": "^2.0.0",
    "react-redux": "5.0.5",
    "react-router-dom": "4.1.1",
    "react-router-redux": "5.0.0-alpha.6",
    "react-transition-group": "^2.2.1",
    "redux": "3.6.0",
    "redux-form": "^7.4.2",
    "redux-immutable": "4.0.0",
    "redux-saga": "0.15.3",
    "reselect": "3.0.1",
    "sanitize.css": "4.1.0",
    "scroll-into-view-if-needed": "^1.4.0",
    "smoothscroll-polyfill": "^0.4.3",
    "splashicon-generator": "^0.2.12",
    "styled-components": "3.1.4",
    "swiper": "^4.3.5",
    "touchmyripple": "^1.6.2",
    "validator": "^9.2.0",
    "warning": "3.0.0",
    "whatwg-fetch": "2.0.3"
  },
  "devDependencies": {
    "@dump247/storybook-state": "^1.5.0",
    "@storybook/addon-actions": "^3.2.13",
    "@storybook/addon-links": "^3.2.13",
    "@storybook/addon-options": "^3.2.13",
    "@storybook/addon-viewport": "^3.3.0-alpha.0",
    "@storybook/react": "^3.2.13",
    "add-asset-html-webpack-plugin": "2.0.1",
    "babel-cli": "6.24.1",
    "babel-core": "6.24.1",
    "babel-eslint": "7.2.3",
    "babel-loader": "7.1.0",
    "babel-plugin-dynamic-import-node": "1.0.2",
    "babel-plugin-react-intl": "2.3.1",
    "babel-plugin-react-transform": "2.0.2",
    "babel-plugin-styled-components": "1.1.4",
    "babel-plugin-transform-es2015-modules-commonjs": "6.24.1",
    "babel-plugin-transform-react-constant-elements": "6.23.0",
    "babel-plugin-transform-react-inline-elements": "6.22.0",
    "babel-plugin-transform-react-remove-prop-types": "0.4.5",
    "babel-preset-env": "1.5.1",
    "babel-preset-react": "6.24.1",
    "babel-preset-stage-0": "6.24.1",
    "circular-dependency-plugin": "3.0.0",
    "copy-webpack-plugin": "^4.2.0",
    "coveralls": "2.13.1",
    "css-loader": "0.28.4",
    "enzyme": "^3.2.0",
    "enzyme-adapter-react-15": "^1.0.5",
    "enzyme-to-json": "^3.2.2",
    "eslint": "3.19.0",
    "eslint-config-airbnb": "15.0.1",
    "eslint-config-airbnb-base": "11.2.0",
    "eslint-import-resolver-webpack": "0.8.3",
    "eslint-plugin-import": "2.7.0",
    "eslint-plugin-jsx-a11y": "5.0.3",
    "eslint-plugin-react": "7.0.1",
    "eslint-plugin-redux-saga": "0.3.0",
    "eventsource-polyfill": "0.9.6",
    "exports-loader": "0.6.4",
    "file-loader": "0.11.1",
    "html-loader": "0.4.5",
    "html-webpack-plugin": "2.29.0",
    "image-webpack-loader": "2.0.0",
    "imports-loader": "0.7.1",
    "jest-cli": "20.0.4",
    "jest-styled-components": "^4.11.0-1",
    "lint-staged": "3.5.1",
    "ngrok": "2.2.9",
    "node-plop": "0.7.0",
    "null-loader": "0.1.1",
    "offline-plugin": "4.8.1",
    "plop": "1.8.0",
    "pre-commit": "1.2.2",
    "raw-loader": "^0.5.1",
    "react-test-renderer": "15.6.1",
    "rimraf": "2.6.1",
    "shelljs": "0.7.7",
    "storybook-addon-intl": "^2.1.2",
    "storybook-readme": "^3.0.6",
    "style-loader": "0.18.1",
    "url-loader": "0.5.8",
    "webfonts-generator": "^0.4.0",
    "webpack": "3.5.5",
    "webpack-dev-middleware": "1.11.0",
    "webpack-hot-middleware": "2.18.0"
  },
  "browser": {
    "child_process": false
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-vibration": {},
      "cordova-plugin-firebase": {},
      "cordova-plugin-x-socialsharing": {},
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": "your usage message",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "your usage message"
      },
      "cordova-universal-links-plugin": {},
      "cordova-plugin-calendar": {
        "CALENDAR_USAGE_DESCRIPTION": "This app uses your calendar"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
}

我尝试按照建议的herehere进行操作,但仍然无法正常工作。我还检查了系统环境变量中是否存在imagemagick。

还有其他建议吗?

0 个答案:

没有答案