apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.71k stars 13.85k forks source link

run “npm run build” failid in superset-frontend (0.37.0) #10997

Closed michaelai0313 closed 2 years ago

michaelai0313 commented 4 years ago

run “npm run build” failid in superset-frontend

Actual results

ERROR in ./src/visualizations/TimeTable/TimeTable.jsx 101:10
Module parse failed: Unexpected token (101:10)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|       if (fullUrl) {
|         return (
>           <a href={fullUrl} rel="noopener noreferrer" target="_blank">
|             {column.label}
|           </a>

ERROR in ./src/SqlLab/App.jsx 111:2
Module parse failed: Unexpected token (111:2)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|
| const Application = () => (
>   <Provider store={store}>
|     <ThemeProvider theme={supersetTheme}>
|       <App />

ERROR in ./src/explore/controls.jsx 135:23
Module parse failed: Unexpected token (135:23)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|   includeTime: false,
|   description: t('One or many controls to group by'),
>   optionRenderer: c => <ColumnOption column={c} showType />,
|   valueRenderer: c => <ColumnOption column={c} />,
|   valueKey: 'column_name',

ERROR in ./src/explore/components/controls/VizTypeControl.jsx 146:6
Module parse failed: Unexpected token (146:6)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|
|     return (
>       <div
|         className={`viztype-selector-container ${isSelected ? 'selected' : ''}
`}
|         onClick={this.onChange.bind(this, key)}

ERROR in ./src/dashboard/components/PropertiesModal.jsx 188:6
Module parse failed: Unexpected token (188:6)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|     const { values, isDashboardLoaded, isAdvancedOpen } = this.state;
|     return (
>       <Modal show={this.props.show} onHide={this.props.onHide} bsSize="lg">
|         <form onSubmit={this.save}>
|           <Modal.Header closeButton>

ERROR in ./src/visualizations/FilterBox/FilterBox.jsx 233:26
Module parse failed: Unexpected token (233:26)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|       }),
|     });
>     const options = (json?.data?.[key] || []).filter(x => x.id);
|     if (!options || options.length === 0) {
|       return [];

ERROR in ./src/components/TableSelector.jsx 243:6
Module parse failed: Unexpected token (243:6)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|   renderDatabaseOption(db) {
|     return (
>       <span>
|         <Label bsStyle="default" className="m-r-5">
|           {db.backend}

ERROR in ./src/showSavedQuery/index.jsx 39:4
Module parse failed: Unexpected token (39:4)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|
|   ReactDom.render(
>     <div>
|       <Form
|         schema={config.JSONSCHEMA}

ERROR in ./src/explore/controlPanels/FilterBox.jsx 41:9
Module parse failed: Unexpected token (41:9)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|           },
|         ],
>         [<hr />],
|         [
|           {

ERROR in ./src/dashboard/index.jsx 42:16
Module parse failed: Unexpected token (42:16)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
| );
|
> ReactDOM.render(<App store={store} />, document.getElementById('app'));
|

ERROR in ./src/explore/controlPanels/Shared_DeckGL.jsx 42:2
Module parse failed: Unexpected token (42:2)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|   'blob/master/superset-frontend/src/modules/sandbox.js';
| const jsFunctionInfo = (
>   <div>
|     {t(
|       'For more information about objects are in context in the scope of this
function, refer to the',

ERROR in ./src/explore/index.jsx 44:16
Module parse failed: Unexpected token (44:16)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
| );
|
> ReactDOM.render(<App store={store} />, document.getElementById('app'));
|

ERROR in ./src/components/TooltipWrapper.jsx 47:4
Module parse failed: Unexpected token (47:4)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
| }) {
|   return (
>     <OverlayTrigger
|       placement={placement}
|       overlay={<Tooltip id={`${kebabCase(label)}-tooltip`}>{tooltip}</Tooltip>
}

ERROR in ./src/components/ErrorBoundary.jsx 50:8
Module parse failed: Unexpected token (50:8)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|       const firstLine = error.toString();
|       const message = (
>         <span>
|           <strong>{t('Unexpected error')}</strong>
|           {firstLine ? `: ${firstLine}` : ''}

ERROR in ./src/components/Button.jsx 54:4
Module parse failed: Unexpected token (54:4)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|
|   let button = (
>     <BootstrapButton {...buttonProps}>{props.children}</BootstrapButton>
|   );
|   if (tooltip) {

ERROR in ./src/components/TableLoader.jsx 64:13
Module parse failed: Unexpected token (64:13)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|   render() {
|     if (this.state.isLoading) {
>       return <Loading />;
|     }
|

ERROR in ./src/components/Menu/Menu.jsx 67:4
Module parse failed: Unexpected token (67:4)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
| }) {
|   return (
>     <StyledHeader className="top" id="main-menu">
|       <Navbar inverse fluid staticTop role="navigation">
|         <Navbar.Header>

ERROR in ./src/components/Select/OnPasteSelect.jsx 79:11
Module parse failed: Unexpected token (79:11)
You may need an appropriate loader to handle this file type, currently no loader
s are configured to process this file. See https://webpack.js.org/concepts#loade
rs
|   render() {
|     const { selectWrap: SelectComponent, ...restProps } = this.props;
>     return <SelectComponent {...restProps} onPaste={this.onPaste} />;
|   }
| }
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! superset@0.37.0 build: `cross-env NODE_OPTIONS=--max_old_space_size=819
2 NODE_ENV=production webpack --mode=production --colors`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the superset@0.37.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

Environment
(please complete the following information):

superset version: 0.36.0
python version: 3.6.10
node.js version: v12.18.3
npm version: 6.14.6
issue-label-bot[bot] commented 4 years ago

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.62. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

mistercrunch commented 4 years ago

npm ci help ? (it nukes /node_modules)

michaelai0313 commented 4 years ago

npm ci help ? (it nukes /node_modules)

when I used npm install,it failed all the time I use yarn to install successfully,but build failed all the time

luoxiao123 commented 4 years ago

i hava the same issue

eschutho commented 4 years ago

can you share the errors that you saw when you ran npm install? It looks like you don't have babel/preset-react installed correctly.

luoxiao123 commented 3 years ago

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Users\lx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'run', 1 verbose cli 'build' 1 verbose cli ] 2 info using npm@6.14.8 3 info using node@v12.16.2 4 verbose run-script [ 'prebuild', 'build', 'postbuild' ] 5 info lifecycle superset@0.38.0~prebuild: superset@0.38.0 6 info lifecycle superset@0.38.0~build: superset@0.38.0 7 verbose lifecycle superset@0.38.0~build: unsafe-perm in lifecycle true 8 verbose lifecycle superset@0.38.0~build: PATH: C:\Users\lx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\lx_workspace\pythonspace\workspace5\incubator-superset-0.38.0\superset-frontend\node_modules.bin;E:\lx_workspace\xshell\;C:\Windows\System32;c:\windows\system32\WindowsPowershell\v1.0;E:\lx_workspace\jdk_dir\jdk1.8.0_191\bin;E:\lx_workspace\jdk_dir\jdk1.8.0_191\jre\bin;C:\Users\lx\Android\Sdk\platform-tools;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;E:\lx_soft\Tesseract-OCR;E:\lx_workspace\pythonspace\sdk3.7.7;E:\lx_workspace\pythonspace\sdk3.7.7\Scripts;C:\Users\lx\AppData\Roaming\npm 9 verbose lifecycle superset@0.38.0~build: CWD: E:\lx_workspace\pythonspace\workspace5\incubator-superset-0.38.0\superset-frontend 10 silly lifecycle superset@0.38.0~build: Args: [ 10 silly lifecycle '/d /s /c', 10 silly lifecycle 'cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production webpack --mode=production --colors' 10 silly lifecycle ] 11 silly lifecycle superset@0.38.0~build: Returned: code: 2 signal: null 12 info lifecycle superset@0.38.0~build: Failed to exec build script 13 verbose stack Error: superset@0.38.0 build: cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production webpack --mode=production --colors 13 verbose stack Exit status 2 13 verbose stack at EventEmitter. (C:\Users\lx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:310:20) 13 verbose stack at ChildProcess. (C:\Users\lx\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:310:20) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) 14 verbose pkgid superset@0.38.0 15 verbose cwd E:\lx_workspace\pythonspace\workspace5\incubator-superset-0.38.0\superset-frontend 16 verbose Windows_NT 6.1.7601 17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\lx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "build" 18 verbose node v12.16.2 19 verbose npm v6.14.8 20 error code ELIFECYCLE 21 error errno 2 22 error superset@0.38.0 build: cross-env NODE_OPTIONS=--max_old_space_size=8192 NODE_ENV=production webpack --mode=production --colors 22 error Exit status 2 23 error Failed at the superset@0.38.0 build script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 2, true ]

image

lybtt commented 3 years ago

I hava the same issue in windows, adding this might help.

image

sonikanishk commented 3 years ago

adding path.resolve(__dirname,'./src') below line 338 in webpack.config.js solved it thanks !!! @lybtt

ktmud commented 3 years ago

This seems to be windows specific. It uses \ in file paths instead of /, breaking the regular expressions in Webpack's loader match rules.