react-chat-widget icon indicating copy to clipboard operation
react-chat-widget copied to clipboard

Webpack error on running `npm run build`

Open luddilo opened this issue 5 years ago • 1 comments

I've just forked to be able to contribute to the repo but got stuck right away. I am getting the below error when trying to run npm run build on a freshly cloned repo just after running npm install.

System is Ubuntu 20.04 on WSL2 / Windows 10.

Note: running the repo with npm run start works without problems

I don't have enough experience with webpack to be able to understand what's wrong. Are there any dependencies on my system that I don't have installed and that aren't included in the repo dependencies?

Thanks,

Ludvig

~/dev/react-chat-widget npm run build

> [email protected] build /home/luddilo/dev/react-chat-widget
> webpack --config ./webpack.config.prod.js

clean-webpack-plugin: /home/luddilo/dev/react-chat-widget/lib has been removed.
Hash: bf53808d8bb1bd5a07d0
Version: webpack 4.42.1
Time: 1137ms
Built at: 08/13/2020 11:50:45 AM
 1 asset
Entrypoint main = index.js
[0] ./src/store/dispatcher.ts 408 bytes {0} [built] [failed] [1 error]
[1] ./src/index.tsx 383 bytes {0} [built] [failed] [1 error]
[2] ./index.js 555 bytes {0} [built]

ERROR in ./src/index.tsx 10:5
Module parse failed: Unexpected token (10:5)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { AnyFunction } from './utils/types';
|
> type Props = {
|   handleNewUserMessage: AnyFunction;
|   handleQuickButtonClicked?: AnyFunction;
 @ ./index.js 1:0-36 3:0-257

ERROR in ./src/store/dispatcher.ts 7:35
Module parse failed: Unexpected token (7:35)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| import { LinkParams, ImageState } from './types';
|
> export function addUserMessage(text: string, id?: string) {
|   store.dispatch(actions.addUserMessage(text, id));
| }
 @ ./index.js 2:0-260 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257 3:0-257
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `webpack --config ./webpack.config.prod.js`
npm ERR! Exit status 2
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!     /home/luddilo/.npm/_logs/2020-08-13T09_50_45_643Z-debug.log

luddilo avatar Aug 13 '20 09:08 luddilo

I did the same as you said but it built in my case and I have not installed any files as such for webpack. One thing to mention I have the nvm installed as described here . If you haven't done from there try reinstalling, Hope it helps.

hp77-creator avatar Sep 15 '20 08:09 hp77-creator