Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roadhog build error #853

Closed
zchuhui opened this issue Feb 1, 2019 · 2 comments
Closed

roadhog build error #853

zchuhui opened this issue Feb 1, 2019 · 2 comments

Comments

@zchuhui
Copy link

zchuhui commented Feb 1, 2019

I need help,my project build is wrong

npm run build
> [email protected] build D:\works\brands\upgrade\Brands-Admin
> roadhog build

Creating an optimized production build...
Failed to compile.

index.js from UglifyJs
Invalid assignment [index.js:111267,30]

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `roadhog build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-02-01T03_24_07_645Z-debug.log

error file: index.js:111267

function encoderForArrayFormat(options) {
	switch (options.arrayFormat) {      
		case 'index':
			return (key, value, index) => {                        // here error
				return value === null ? [
					encode(key, options),
					'[',
					index,
					']'
				].join('') : [
					encode(key, options),
					'[',
					encode(index, options),
					']=',
					encode(value, options)
				].join('');
			};
		case 'bracket':
			return (key, value) => {
				return value === null ? [encode(key, options), '[]'].join('') : [
					encode(key, options),
					'[]=',
					encode(value, options)
				].join('');
			};
		default:
			return (key, value) => {
				return value === null ? encode(key, options) : [
					encode(key, options),
					'=',
					encode(value, options)
				].join('');
			};
	}
}

my package.json:

{
  "private": true,
  "name": "brand-admin",
  "version": "3.0.2",
  "dependencies": {
    "antd": "^3.12.4",
    "axios": "^0.16.2",
    "babel-polyfill": "^6.23.0",
    "classnames": "^2.2.5",
    "copy-to-clipboard": "^3.0.8",
    "draftjs-to-markdown": "^0.4.0",
    "dva": "^2.4.1",
    "dva-loading": "^0.2.3",
    "dva-react-router-3": "^1.2.1",
    "ejs-loader": "^0.3.0",
    "history": "^4.7.2",
    "js-beautify": "^1.6.14",
    "jsonp": "^0.2.1",
    "less-vars-to-js": "^1.1.2",
    "lodash": "^4.17.4",
    "mockjs": "^1.0.1-beta3",
    "nprogress": "^0.2.0",
    "path-to-regexp": "^1.7.0",
    "prop-types": "^15.5.10",
    "qs": "^6.5.0",
    "query-string": "^6.2.0",
    "rc-queue-anim": "^1.5.0",
    "rc-tween-one": "^1.3.1",
    "react": "^16.2.0",
    "react-color": "^2.13.5",
    "react-countup": "2.1.1",
    "react-dom": "^16.2.0",
    "react-dragula": "^1.1.17",
    "react-helmet": "^5.1.3",
    "react-images": "^0.5.19",
    "react-intl-universal": "^1.11.2",
    "react-router-dom": "^4.3.1",
    "react-sortable": "^1.3.2",
    "react-sortable-tree": "^1.8.1",
    "react-viewer": "^2.6.0",
    "reactour": "^1.8.7",
    "reqwest": "^2.0.5",
    "styled-components": "^3.4.6"
  },
  "devDependencies": {
    "babel": "^6.23.0",
    "babel-eslint": "^7.2.3",
    "babel-plugin-dev-expression": "^0.2.1",
    "babel-plugin-dva-hmr": "^0.3.2",
    "babel-plugin-import": "^1.1.1",
    "babel-plugin-module-resolver": "^3.1.0",
    "babel-plugin-transform-runtime": "^6.9.0",
    "babel-runtime": "^6.9.2",
    "copy-webpack-plugin": "^4.0.1",
    "draftjs-to-html": "^0.7.0",
    "dva-model-extend": "^0.1.1",
    "eslint": "^4.1.1",
    "eslint-config-airbnb": "^15.0.2",
    "eslint-import-resolver-node": "^0.3.1",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-flowtype": "^3.2.1",
    "eslint-plugin-import": "^2.6.1",
    "eslint-plugin-jsx-a11y": "^6.0.2",
    "eslint-plugin-react": "^7.1.0",
    "html-webpack-plugin": "^2.29.0",
    "husky": "^0.14.3",
    "lint-staged": "^4.0.4",
    "redbox-react": "^1.2.10",
    "roadhog": "1.3.1"
  },
  "pre-commit": [
    "lint"
  ],
  "scripts": {
    "dev": "set BROWSER=none&&set HOST=0.0.0.0&&set PORT=8067&&roadhog server",
    "lint": "eslint --fix --ext .js src",
    "build": "roadhog build",
    "analyze": "roadhog build --analyze",
    "build:dll": "roadhog buildDll"
  },
  "lint-staged": {
    "src/**/*.js": [
      "eslint --fix",
      "git add"
    ]
  }
}

直接使用 roadhog build,打包过程是没有报错的,但打包的文件是用不了的,会报错。(本地环境的roadhog也是1.3.1)
而使用npm run build,直接报错。
使用roadhog build --debug 也是没问题的

求排解方式...

please....help......me.....

@sorrycc

@Petro5512
Copy link

最后解决了吗

@sorrycc
Copy link
Owner

sorrycc commented Apr 12, 2019

参考 sorrycc/blog#68 解决。

@sorrycc sorrycc closed this as completed Apr 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants