将带有Parcel的React App部署到Heroku提供中无法解决依赖关系错误

时间:2018-10-04 04:14:48

标签: javascript npm

我已经构建了一个小型应用程序,并试图将其部署到Heroku,但我不断收到此错误:无法解析依赖项'@ emotion / is-prop-valid'。我没有为此项目使用create-react-app。

完整的消息是:/tmp/build_7241c20b1c425be31049d4add81a048a/node_modules/react-pose/lib/index.js:10:42:无法解析依赖项'@ emotion / is-prop-valid'

package.json文件如下所示:

{
  "name": "name",
  "version": "2.0.0",
  "description": "description",
  "engines": {
    "npm": "6.0.0",
    "node": "10.9.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "format": "prettier --write \"src/**/*.{js,jsx,css,json}\"",
    "format:check": "prettier --list-different \" src/**/*.{js,jsx,css,json}\"",
    "lint": "eslint \" eslint src/**/*,{js,jsx}\"",
    "dev": "parcel src/index.html",
    "start": "serve -s build",
    "build": "parcel build src/index.html",
    "heroku-postbuild": "parcel build src/index.html"
  },
  "repository": {
    "type": "git",
    "url": "url"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.6.1",
    "eslint-config-prettier": "^3.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-prettier": "^2.7.0",
    "eslint-plugin-react": "^7.11.1",
    "parcel-bundler": "^1.10.1",
    "prettier": "^1.14.3"
  },
  "dependencies": {
    "@reach/router": "^1.2.1",
    "axios": "^0.18.0",
    "prop-types": "^15.6.2",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-pose": "^3.3.6",
    "react-spring": "^5.9.0",
    "serve": "^10.0.2"
  }
}

我环顾四周,但是找不到其他遇到这种错误的人。我的理论是,react-pose取决于该情感模块,但是我不知道如何让Heroku下载它。

任何帮助将不胜感激,谢谢!

1 个答案:

答案 0 :(得分:0)

尝试:

{
  "name": "name",
  "version": "2.0.0",
  "description": "description",
  "engines": {
    "npm": "6.0.0",
    "node": "10.9.0"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "format": "prettier --write \"src/**/*.{js,jsx,css,json}\"",
    "format:check": "prettier --list-different \" src/**/*.{js,jsx,css,json}\"",
    "lint": "eslint \" eslint src/**/*,{js,jsx}\"",
    "dev": "parcel src/index.html",
    "start": "./node_modules/parcel-bundler/bin/cli.js src/index.html",
    "build": "parcel build src/index.html",
    "heroku-postbuild": "parcel build src/index.html"
  },
  "repository": {
    "type": "git",
    "url": "url"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@babel/core": "^7.0.0",
    "@babel/plugin-proposal-class-properties": "^7.0.0",
    "@babel/preset-env": "^7.0.0",
    "@babel/preset-react": "^7.0.0",
    "babel-eslint": "^10.0.1",
    "eslint": "^5.6.1",
    "eslint-config-prettier": "^3.1.0",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-prettier": "^2.7.0",
    "eslint-plugin-react": "^7.11.1",
    "parcel-bundler": "^1.10.1",
    "prettier": "^1.14.3"
  },
  "dependencies": {
    "@reach/router": "^1.2.1",
    "axios": "^0.18.0",
    "prop-types": "^15.6.2",
    "react": "^16.5.2",
    "react-dom": "^16.5.2",
    "react-pose": "^3.3.6",
    "react-spring": "^5.9.0",
    "serve": "^10.0.2"
  }
}