Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 无法解析模块';巴别塔&x27;当运行dist时_Reactjs_Heroku_Npm_Production_Generator React Webpack - Fatal编程技术网

Reactjs 无法解析模块';巴别塔&x27;当运行dist时

Reactjs 无法解析模块';巴别塔&x27;当运行dist时,reactjs,heroku,npm,production,generator-react-webpack,Reactjs,Heroku,Npm,Production,Generator React Webpack,我已经在GeneratorReact网页上构建了我的项目。现在我正在尝试将我的react应用程序部署到Heroku。在构建依赖关系的过程中,我遇到一个错误: npm run copy & webpack --env=dist remote: remote: Hash: 82c8f499a3f6822a3522 remote: Version: webpack 1.13.3 remote: Time: 73ms remote:

我已经在GeneratorReact网页上构建了我的项目。现在我正在尝试将我的react应用程序部署到Heroku。在构建依赖关系的过程中,我遇到一个错误:

npm run copy & webpack --env=dist
remote:        
remote:        Hash: 82c8f499a3f6822a3522
remote:        Version: webpack 1.13.3
remote:        Time: 73ms
remote:        
remote:        ERROR in Entry module not found: Error: Cannot resolve module 'babel' in /tmp/build_a9e8f64bdab19b2486d922d4ba0f3d83
装载机似乎有点奇怪。我试图在依赖项中包含“babel”,也试图用“babel core”替换它,但它不起作用

我对这个问题非常失望,如果有人能帮助我,我会非常感激。谢谢


package.json

{
  "name": "templateApp",
  "private": true,
  "version": "0.0.1",
  "description": "Template application for future builds",
  "main": "",
  "engines": {
    "node": "6.2.2"
  },
  "scripts": {
    "clean": "rimraf dist/*",
    "copy": "copyfiles -f ./src/index.html ./src/favicon.ico ./dist",
    "dist": "npm run copy & webpack --env=dist",
    "lint": "eslint ./src",
    "posttest": "npm run lint",
    "release:major": "npm version major && npm publish && git push --follow-tags",
    "release:minor": "npm version minor && npm publish && git push --follow-tags",
    "release:patch": "npm version patch && npm publish && git push --follow-tags",
    "serve": "node server.js --env=dev",
    "serve:dist": "node server.js --env=dist",
    "dev": "node server.js --env=dev",
    "start": "node server.js --env=dev",
    "test": "karma start",
    "test:watch": "karma start --autoWatch=true --singleRun=false",
    "postinstall": "npm run dist && npm run start"
  },
  "repository": "",
  "keywords": [],
  "author": "Alfred Ödling",
  "devDependencies": {
    "babel-core": "^6.0.0",
    "babel-eslint": "^6.0.0",
    "babel-loader": "^6.0.0",
    "babel-polyfill": "^6.3.14",
    "babel-preset-es2015": "^6.0.15",
    "babel-preset-react": "^6.0.15",
    "babel-preset-stage-0": "^6.5.0",
    "bower-webpack-plugin": "^0.1.9",
    "chai": "^3.2.0",
    "copyfiles": "^0.2.1",
    "css-loader": "^0.23.0",
    "eslint": "^2.2.0",
    "eslint-loader": "^1.0.0",
    "eslint-plugin-react": "^5.0.0",
    "file-loader": "^0.8.4",
    "glob": "^7.0.0",
    "isparta-instrumenter-loader": "^1.0.0",
    "karma": "^0.13.9",
    "karma-chai": "^0.1.0",
    "karma-coverage": "^1.0.0",
    "karma-mocha": "^1.0.0",
    "karma-mocha-reporter": "^2.0.0",
    "karma-phantomjs-launcher": "^1.0.0",
    "karma-sourcemap-loader": "^0.3.5",
    "karma-webpack": "^1.7.0",
    "lost": "^7.0.3",
    "minimist": "^1.2.0",
    "mocha": "^2.2.5",
    "node-sass": "^3.4.2",
    "null-loader": "^0.1.1",
    "open": "0.0.5",
    "phantomjs-prebuilt": "^2.0.0",
    "postcss": "^5.0.11",
    "postcss-loader": "^0.8.0",
    "react-addons-test-utils": "^15.0.0",
    "react-hot-loader": "^1.2.9",
    "rimraf": "^2.4.3",
    "rucksack-css": "^0.8.6",
    "sass-loader": "^3.1.2",
    "style-loader": "^0.13.0",
    "url-loader": "^0.5.6",
    "webpack": "^1.12.0",
    "webpack-dev-server": "^1.12.0"
  },
  "dependencies": {
    "autoprefixer": "^6.3.7",
    "axios": "^0.13.1",
    "classnames": "^2.2.5",
    "clipboard": "^1.5.12",
    "core-js": "^2.0.0",
    "firebase": "^3.4.1",
    "fixed-data-table": "^0.6.3",
    "flat": "^2.0.1",
    "history": "^3.0.0",
    "lodash": "^4.15.0",
    "lost": "^7.0.3",
    "normalize.css": "^4.0.0",
    "postcss": "^5.1.1",
    "postcss-cli": "^2.5.2",
    "postcss-cssnext": "^2.8.0",
    "postcss-import": "^8.1.2",
    "postcss-loader": "^0.8.2",
    "react": "^15.0.0",
    "react-addons-css-transition-group": "^15.3.0",
    "react-cookie": "^0.4.8",
    "react-datagrid": "^2.1.1",
    "react-dom": "^15.3.1",
    "react-redux": "^4.4.5",
    "react-router": "^2.6.1",
    "react-tooltip": "^3.2.1",
    "redux": "^3.5.2",
    "redux-thunk": "^2.1.0",
    "rucksack-css": "^0.8.6",
    "seamless-immutable": "^6.1.1"
  }
}
dist.js

'use strict';

let path = require('path');
let webpack = require('webpack');

let baseConfig = require('./base');
let defaultSettings = require('./defaults');

// Add needed plugins here
let BowerWebpackPlugin = require('bower-webpack-plugin');

let config = Object.assign({}, baseConfig, {
  entry: path.join(__dirname, '../src/index'),
  cache: false,
  devtool: 'sourcemap',
  plugins: [
    new webpack.optimize.DedupePlugin(),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': '"production"'
    }),
    new BowerWebpackPlugin({
      searchResolveModulesDirectories: false
    }),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.AggressiveMergingPlugin(),
    new webpack.NoErrorsPlugin()
  ],
  module: defaultSettings.getDefaultModules()
});

// Add needed loaders to the defaults here
config.module.loaders.push({
  test: /\.(js|jsx)$/,
  loader: 'babel',
  include: [].concat(
    config.additionalPaths,
    [ path.join(__dirname, '/../src') ]
  )
});

module.exports = config;

能否将您的条目从
dist.js
文件更改为:

entry: [
  'babel-polyfill',
  path.join(__dirname, '../src/index')
],

能否将您的条目从
dist.js
文件更改为:

entry: [
  'babel-polyfill',
  path.join(__dirname, '../src/index')
],

“确保在heroku上设置NPM_CONFIG_PRODUCTION=false。如果没有此devdependency,将无法安装。这是构建此样板文件所需的

如果已安装heroku cli,则可以 heroku config:set NPM\u config\u PRODUCTION=false——应用程序名称

否则,请转到应用程序上的“设置”选项卡并添加配置变量“

这个修好了

来自

“确保在heroku上设置NPM_CONFIG_PRODUCTION=false。如果没有此devdependency,将无法安装。这是构建此样板文件所需的

如果已安装heroku cli,则可以 heroku config:set NPM\u config\u PRODUCTION=false——应用程序名称

否则,请转到应用程序上的“设置”选项卡并添加配置变量“


这个修好了

你有.babelrc文件吗?有!包含:{“预设”:[“es2015”、“stage-0”、“react”]}您有.babelrc文件吗?有!包含:{“预设”:[“es2015”,“stage-0”,“react”]}我这样做了,还向依赖项添加了babel polyfill,因为它一开始没有找到它。当运行运行“>copyfiles-f./src/index.html./src/favicon.ico./dist”的“npm run copy&webpack--env=dist”时,我会得到错误“sh:1:copyfiles:not found”,随后会出现更多由此产生的错误。在构建产品时,它好像无法访问package.json中的依赖项。我这样做了,还向依赖项添加了babel polyfill,因为它一开始没有找到它。当运行运行“>copyfiles-f./src/index.html./src/favicon.ico./dist”的“npm run copy&webpack--env=dist”时,我会得到错误“sh:1:copyfiles:not found”,随后会出现更多由此产生的错误。在构建产品时,它似乎无法访问package.json中的依赖项。