Deployment Heroku, Build stopping after webpack bundles on heroku? - node.js

Not sure how to set up my environment to get my MERN application deployed on Heroku. I'm using EJS and webpack. When I deploy the application it is currently staying stuck at the webpack build phase:
-----> Using buildpack: heroku/nodejs
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): 12.18.3
engines.npm (package.json): unspecified (use default)
Resolving node version 12.18.3...
Downloading and installing node 12.18.3...
Using default npm version: 6.14.6
-----> Restoring cache
Cached directories were not restored due to a change in version of node, npm, yarn or stack
Module installation may take longer for this build
-----> Installing dependencies
Installing node modules
> fsevents#1.2.13 install /tmp/build_31a40992/node_modules/nodemon/node_modules/fsevents
> node install.js
Skipping 'fsevents' build as platform linux is not supported
> nodemon#1.19.4 postinstall /tmp/build_31a40992/node_modules/nodemon
> node bin/postinstall || exit 0
Love nodemon? You can now support the project via the open collective:
> https://opencollective.com/nodemon/donate
> bcrypt#5.0.1 install /tmp/build_31a40992/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/tmp/build_31a40992/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" is installed via remote
added 1003 packages in 7.872s
-----> Build
Running build
> project#1.0.0 build /tmp/build_31a40992
> webpack --mode production
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
asset App.js 592 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 10.6 KiB [orphan] 3 modules
runtime modules 663 bytes 3 modules
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 18.3 KiB
./src/App.jsx + 3 modules 17.2 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/PricesComponent.css 1.1 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
App.js (592 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (583 KiB)
BuyOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33959 ms
asset Edit.js 580 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 14.8 KiB
./src/AppDep/Edit.jsx + 1 modules 12.2 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
Edit.js (580 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (580 KiB)
Edit.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33955 ms
asset MakeBuy.js 572 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 9.07 KiB
./src/AppDep/MakeBuy.jsx + 1 modules 8.12 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Make.css 975 bytes [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MakeBuy.js (572 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (572 KiB)
MakeBuy.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33960 ms
asset MakeSell.js 572 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.13 KiB [orphan] 1 module
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 9.48 KiB
./src/AppDep/MakeSell.jsx + 1 modules 8.53 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Make.css 975 bytes [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MakeSell.js (572 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (572 KiB)
MakeSell.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 34225 ms
asset MyOrders.js 665 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 531 KiB [orphan] 266 modules
runtime modules 663 bytes 3 modules
cacheable modules 212 KiB
modules by path ./node_modules/ 142 KiB 15 modules
modules by path ./src/ 70.3 KiB
./src/AppDep/MyOrders.jsx + 12 modules 59.7 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/MyOrders.css 1.11 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Order.css 710 bytes [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Matches.css 1.17 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
+ 2 modules
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
MyOrders.js (665 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (665 KiB)
MyOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 37873 ms
asset Order.js 603 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
orphan modules 501 KiB [orphan] 259 modules
runtime modules 663 bytes 3 modules
cacheable modules 174 KiB
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
+ 1 module
modules by path ./src/ 32.8 KiB
./src/AppDep/Order.jsx + 5 modules 26.8 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Order.css 710 bytes [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Edit.css 2.64 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Form.css 2.71 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
Order.js (603 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (603 KiB)
Order.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 37116 ms
asset Prices.js 34.5 KiB [compared for emit] [minimized] (name: main) 1 related asset
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
./src/AppDep/Prices.jsx 3.99 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11248 ms
asset PricesComponent.js 69 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 5.14 KiB [orphan] 2 modules
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 11.7 KiB
./src/AppDep/PricesComponent.jsx + 2 modules 10.6 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/PricesComponent.css 1.1 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11402 ms
asset SellOrders.js 583 KiB [compared for emit] [minimized] [big] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 6.42 KiB [orphan] 2 modules
modules by path ./node_modules/ 142 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB 2 modules
modules by path ./node_modules/react-dom/ 119 KiB 2 modules
modules by path ./node_modules/scheduler/ 4.91 KiB 2 modules
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB 2 modules
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 20 KiB
./src/AppDep/SellOrders.jsx + 2 modules 17.4 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/SellOrders.css 2.6 KiB [built] [code generated]
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
SellOrders.js (583 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
main (583 KiB)
SellOrders.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
webpack 5.67.0 compiled with 3 warnings in 33961 ms
asset Navigation.js 75.3 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.15 KiB [orphan] 1 module
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 11 KiB
./src/AppDep/Navigation.jsx + 1 modules 6.73 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/Navigation.css 4.27 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11400 ms
asset MatcheRow.js 69.4 KiB [compared for emit] [minimized] (name: main) 1 related asset
runtime modules 663 bytes 3 modules
orphan modules 1.14 KiB [orphan] 1 module
modules by path ./node_modules/ 17.4 KiB
modules by path ./node_modules/style-loader/dist/runtime/*.js 5.02 KiB 6 modules
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/css-loader/dist/runtime/*.js 3.85 KiB
./node_modules/css-loader/dist/runtime/cssWithMappingToString.js 2.28 KiB [built] [code generated]
./node_modules/css-loader/dist/runtime/api.js 1.57 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
modules by path ./src/ 8.09 KiB
./src/AppDep/MatcheRow.jsx + 1 modules 5.82 KiB [built] [code generated]
./node_modules/css-loader/dist/cjs.js!./src/styles/MatcheRow.css 2.27 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 11399 ms
So ... webpack 5.67.0 compiled successfully in 11399 ms
but ... I ideally want to run
npm run server
after the build.
As a reference a successful MERN deployment on heroku should look like this:
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.18.3...
Using default npm version: 6.14.15
-----> Installing dependencies
Installing node modules
added 538 packages in 5.08s
-----> Build
Running build
> deploy-react-webpack#1.0.0 build /tmp/build_8c86a15a
> webpack --mode production
asset main.js 129 KiB [emitted] [minimized] (name: main) 1 related asset
asset ./index.html 278 bytes [emitted]
modules by path ./node_modules/react/ 6.48 KiB
./node_modules/react/index.js 190 bytes [built] [code generated]
./node_modules/react/cjs/react.production.min.js 6.3 KiB [built] [code generated]
modules by path ./node_modules/react-dom/ 119 KiB
./node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
./node_modules/react-dom/cjs/react-dom.production.min.js 118 KiB [built] [code generated]
modules by path ./node_modules/scheduler/ 4.91 KiB
./node_modules/scheduler/index.js 198 bytes [built] [code generated]
./node_modules/scheduler/cjs/scheduler.production.min.js 4.72 KiB [built] [code generated]
./src/index.js 3.64 KiB [built] [code generated]
./node_modules/object-assign/index.js 2.06 KiB [built] [code generated]
webpack 5.67.0 compiled successfully in 3745 ms
-----> Caching build
- node_modules
-----> Pruning devDependencies
removed 473 packages and audited 64 packages in 2.943s
2 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
-----> Build succeeded!
-----> Discovering process types
Procfile declares types -> (none)
Default types for buildpack -> web
-----> Compressing...
Done: 34.2M
-----> Launching...
Released v3
https://morning-sands-39344.herokuapp.com/ deployed to Heroku
Any ideas what is the issue?
These are my main setup files
webpack.config.js
const path = require('path')
// module.exports = {
// entry: './public/App.js',
// output: {
// filename: 'App.js',
// path: path.resolve(__dirname, 'dist'),
// },
// watch: true,
// mode: 'development',
// }
var config = {
watch: true,
mode: 'development',
resolve: {
extensions: ['.js', '.jsx']
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: [/\.js$/, /\.jsx$/],
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [
["#babel/preset-env", {
"targets": {
"ie": "11",
"edge": "15",
"safari": "10",
"firefox": "50",
"chrome": "49"
}
}],
"#babel/preset-react"
]
}
}
}
]
},
devtool : 'inline-source-map',
};
var fooConfig = Object.assign({}, config, {
//name: "a",
entry: './src/App.jsx',
output: {
filename: 'App.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var barConfig = Object.assign({}, config,{
entry: './src/Databases.jsx',
output: {
filename: 'Databases.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var booConfig = Object.assign({}, config,{
entry: './src/Matches.jsx',
output: {
filename: 'Matches.js',
path: path.resolve(__dirname, 'public/dist'),
},
});
var Config1 = Object.assign({}, config,{
entry: './src/AppDep/BuyOrders.jsx',
output: {
filename: 'BuyOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config2 = Object.assign({}, config,{
entry: './src/AppDep/Edit.jsx',
output: {
filename: 'Edit.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config3 = Object.assign({}, config,{
entry: './src/AppDep/MakeBuy.jsx',
output: {
filename: 'MakeBuy.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config4 = Object.assign({}, config,{
entry: './src/AppDep/MakeSell.jsx',
output: {
filename: 'MakeSell.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config5 = Object.assign({}, config,{
entry: './src/AppDep/MyOrders.jsx',
output: {
filename: 'MyOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config6 = Object.assign({}, config,{
entry: './src/AppDep/Order.jsx',
output: {
filename: 'Order.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config7 = Object.assign({}, config,{
entry: './src/AppDep/Prices.jsx',
output: {
filename: 'Prices.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config8 = Object.assign({}, config,{
entry: './src/AppDep/PricesComponent.jsx',
output: {
filename: 'PricesComponent.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config9 = Object.assign({}, config,{
entry: './src/AppDep/SellOrders.jsx',
output: {
filename: 'SellOrders.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config10 = Object.assign({}, config,{
entry: './src/AppDep/Navigation.jsx',
output: {
filename: 'Navigation.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
var Config11 = Object.assign({}, config,{
entry: './src/AppDep/MatcheRow.jsx',
output: {
filename: 'MatcheRow.js',
path: path.resolve(__dirname, 'public/dist/AppDep'),
},
});
// Return Array of Configurations
module.exports = [
fooConfig, barConfig, booConfig, Config1, Config2, Config3, Config4, Config5, Config6, Config7, Config8, Config9, Config10, Config11
];
Thanks

Heroku uses Procfiles or the start command to start your server. Add a start command at the script section in your package.json that points to your nodejs server.
"script": {
"start": "node pathtoyourserver.js"
}
Or you can add a Procfile
web: node pathtoyourserver.js
or use your npm command
web: npm run server
https://devcenter.heroku.com/articles/nodejs-support

Related

Error: Cannot find module './undefined' with discord-buttons, discord.js, TypeScrpit and webpack

I use TypeScript and Webpack for my Discord bot. It used to compile with no problems, until I tried to use discord-buttons.
I've found some questions and answers about discord.js, TypesScript and Webpack. But no one of them say something about discord-buttons.
The module.exports in my webpack config file looks like this:
entry: {
index: {
import: "./src/index.ts",
dependOn: ["discord", "buttons"]
},
discord: "discord.js",
buttons: "discord-buttons"
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist")
},
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
}, ],
},
target: "node",
externals: [nodeExternals()],
My index.ts file does nothing with discord-buttons but importing it and using disbut
import { Client, Message, MessageEmbed, TextChannel } from "discord.js"
import disbut from 'discord-buttons'
const token:string = `token`
const client: Client = new Client()
disbut(client)
client.login(token)
When I build with Webpack (in development mode), it says there is no error, but I get one when I run the index.bundle.js
> webpack --mode development --config webpack.config.dev.js
asset index.bundle.js 75.4 KiB [emitted] (name: index)
asset buttons.bundle.js 6.75 KiB [compared for emit] (name: buttons)
asset discord.bundle.js 6.72 KiB [compared for emit] (name: discord)
runtime modules 5.42 KiB 16 modules
built modules 62.7 KiB [built]
cacheable modules 62.6 KiB
modules by path ./src/modules/*.ts 48.5 KiB
./src/modules/CommandManager.ts 19.8 KiB [built] [code generated]
./src/modules/OutputManager.ts 2.05 KiB [built] [code generated]
./src/modules/LogManager.ts 3.59 KiB [built] [code generated]
./src/modules/FirebaseManager.ts 17.9 KiB [built] [code generated]
./src/modules/SpikeChannels.ts 5.17 KiB [built] [code generated]
./src/index.ts 11.8 KiB [built] [code generated]
./spike-database-firebase-admin-ETC.json 2.26 KiB [built] [code generated]
external "discord.js" 42 bytes [built] [code generated]
external "discord-buttons" 42 bytes [built] [code generated]
external "fastest-levenshtein" 42 bytes [built] [code generated]
external "firebase-admin" 42 bytes [built] [code generated]
webpack 5.46.0 compiled successfully in 4242 ms
> spike-bot#1.0.0 bot
> node ./dist/index.bundle.js
node:internal/modules/cjs/loader:930
throw err;
^
Error: Cannot find module './undefined'
Require stack:
- /home/eban/PATH_TO_PROJECT/dist/discord.bundle.js
- /home/eban/PATH_TO_PROJECT/dist/index.bundle.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:927:15)
at Function.Module._load (node:internal/modules/cjs/loader:772:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.__webpack_require__.f.require (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:157:28)
at /home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:84:40
at Array.reduce (<anonymous>)
at Function.__webpack_require__.e (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:83:67)
at Array.map (<anonymous>)
at Function.__webpack_require__.X (/home/eban/PATH_TO_PROJECT/dist/discord.bundle.js:121:22) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/PATH_TO_PROJECT/dist/discord.bundle.js',
'/home/PATH_TO_PROJECT/dist/index.bundle.js'
]
}
The problem seems to be that you added entry points for external modules, namely your discord and buttons entry points. Entry points should be for your own scripts, usually not externals. If you're not planning on running multiple processes, a single entry point is also all you need.

Running Fluid Hello World Example Error Out

I'm trying to run Fluid Hello World Example, after going through the steps and running the application the web browser error out with the following log message:
POST http://localhost:3000/documents/tinylicious 400 (Bad Request) with response body is 502.
Did I miss any step?
Update:
Running on Windows 10 1809 (1763.1397)
Console Output:
#fluid-example/hello-world#0.1.0 start C:\Users\****\Documents\Workspace\FluidHelloWorld
> concurrently "npm:start:server" "npm:start:client"
[start:server]
[start:server] > #fluid-example/hello-world#0.1.0 start:server C:\Users\****\Documents\Workspace\FluidHelloWorld
[start:server] > tinylicious
[start:server]
[start:client]
[start:client] > #fluid-example/hello-world#0.1.0 start:client C:\Users\****\Documents\Workspace\FluidHelloWorld
[start:client] > webpack-dev-server --open
[start:client]
[start:server] info: Listening on port 3000 {"label":"winston","timestamp":"2020-09-11T16:02:56.224Z"}
[start:client] i 「wds」: Project is running at http://localhost:8080/
[start:client] i 「wds」: webpack output is served from /
[start:client] i 「wds」: Content not from webpack is served from C:\Users\KISA01\Documents\Workspace\FluidHelloWorld
[start:client] i 「wdm」: wait until bundle finished: /
[start:client] i 「wdm」: Hash: 15f0e0aa78bd7f0ce32e
[start:client] Version: webpack 4.44.1
[start:client] Time: 11959ms
[start:client] Built at: 09/11/2020 12:03:10 PM
[start:client] Asset Size Chunks Chunk Names
[start:client] app.52afa0dcefa1c58ec9c3.js 7.84 MiB app [emitted] [immutable] app
[start:client] index.html 667 bytes [emitted]
[start:client] Entrypoint app = app.52afa0dcefa1c58ec9c3.js
[start:client] [0] multi (webpack)-dev-server/client?http://localhost:8080 ./src/app.ts 40 bytes {app} [built]
[start:client] [./node_modules/#fluidframework/aqueduct/lib/index.js] 925 bytes {app} [built]
[start:client] [./node_modules/#fluidframework/get-tinylicious-container/lib/index.js] 180 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {app} [built]
[start:client] [./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {app} [built]
[start:client] [./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js] (webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {app} [built]
[start:client] [./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {app} [built]
[start:client] [./src/app.ts] 3.3 KiB {app} [built]
[start:client] [./src/containerCode.ts] 1.03 KiB {app} [built]
[start:client] [./src/view.ts] 1.41 KiB {app} [built]
[start:client] + 658 hidden modules
[start:client] Child HtmlWebpackCompiler:
[start:client] 1 asset
[start:client] Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[start:client] [./node_modules/html-webpack-plugin/lib/loader.js!./src/index.html] 913 bytes {HtmlWebpackPlugin_0} [built]
[start:client] i 「wdm」: Compiled successfully.
[start:server] info: OPTIONS /documents/tinylicious 204 3.718 ms - 0 {"label":"winston","timestamp":"2020-09-11T16:03:11.686Z"}
[start:server] info: POST /documents/tinylicious 400 180.004 ms - 3 {"label":"winston","timestamp":"2020-09-11T16:03:11.869Z"}

Angular universal - warning while running node.js

I have angular 7 site - which I have converted into server side rendering (referring mainly https://blog.angular-university.io/angular-universal/).
I am running site on AWS using 'foreever'. I aways see below error inside my foreever error log file:
(node:23488) [DEP0005] DeprecationWarning: Buffer() is deprecated due to
security and usability issues. Please use the Buffer.alloc(),
Buffer.allocUnsafe(), or Buffer.from() methods instead.
I have not used any kind of buffer in my code, so my guess is it might be coming from node modules I am using. From above log message I am unable to detect which module is having problem.
My current package.json looks like below:
"dependencies": {
"#angular/animations": "^7.0.0",
"#angular/common": "^7.0.0",
"#angular/compiler": "^7.0.0",
"#angular/core": "^7.0.0",
"#angular/forms": "^7.0.0",
"#angular/http": "^7.0.0",
"#angular/platform-browser": "^7.0.0",
"#angular/platform-browser-dynamic": "^7.0.0",
"#angular/platform-server": "^7.0.0",
"#angular/router": "^7.0.0",
"#nguniversal/express-engine": "^7.0.2",
"#nguniversal/module-map-ngfactory-loader": "^7.0.2",
"bootstrap": "^3.4.0",
"chart.js": "^2.7.3",
"core-js": "^2.6.1",
"express": "^4.16.2",
"font-awesome": "^4.7.0",
"fullcalendar": "^3.9.0",
"he": "^1.2.0",
"jquery": "^3.3.1",
"jw-angular-social-buttons": "^1.0.0",
"moment": "^2.23.0",
"ng2-validation": "^4.2.0",
"primeicons": "^1.0.0",
"primeng": "^6.1.7",
"prismjs": "^1.15.0",
"rxjs": "~6.3.3",
"ts-loader": "^5.3.2",
"webpack": "^4.28.3",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.14",
"zone.js": "~0.8.26"
}
Is there any way to get more logs ? Can I neglect this error message for now?
Thanks in advance.
EDIT-
My package.json has following:
"build-both": "ng build --prod --output-path=dist/browser && ng run
ecokrypt-uiapp:server --configuration=publiclocal
--output-path=dist/server",
"webpack-server": "webpack --config webpack.server.config.js
--ouput dist/server.js --progress --colors",
"build-and-pack": "npm run build-both && npm run webpack-server",
When I build the application (npm run build-and-pack): I see following in my console: I see 2 warnings related to some System.Import()
> ecokrypt-uiapp#0.0.0 build-and-pack
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> npm run build-both && npm run webpack-server
> ecokrypt-uiapp#0.0.0 build-both
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> ng build --prod --output-path=dist/browser && ng run ecokrypt-uiapp:server
--configuration=publiclocal --output-path=dist/server
Date: 2019-01-22T06:03:27.567Z
Hash: 6cdc328f7a5e6deddab8
Time: 74400ms
chunk {scripts} scripts.121b013aaa5e9461a940.js (scripts) 632 kB [rendered]
chunk {0} runtime.ec2944dd8b20ec099bf3.js (runtime) 1.41 kB [entry]
[rendered]
chunk {1} main.1c45daaf038705b9a051.js (main) 2.27 MB [initial] [rendered]
chunk {2} polyfills.8b3031f6891125c33792.js (polyfills) 58.2 kB [initial]
[rendered]
chunk {3} styles.64324cbe6f1a4899818f.css (styles) 325 kB [initial]
[rendered]
Date: 2019-01-22T06:03:52.985Z
Hash: 103ec2f268f0c9fbf2a1
Time: 22538ms
chunk {main} main.js, main.js.map (main) 2.75 MB [entry] [rendered]
> ecokrypt-uiapp#0.0.0 webpack-server
/Users/manisha/projects/ecokrypt/repos/ecokrypt-uiapp
> webpack --config webpack.server.config.js --ouput dist/server.js --progress
--colors
Hash: 8961a2409cb304bef9ec
Version: webpack 4.28.3
Time: 11323ms
Built at: 2019-01-22 11:34:05
Asset Size Chunks Chunk Names
server.js 9.82 MiB server [emitted] server
Entrypoint server = server.js
[./dist/server/main.js] 2.75 MiB {server} [built]
[./server.ts] 1.93 KiB {server} [built]
[./src lazy recursive] ./src lazy namespace object 160 bytes {server} [built]
[./src sync recursive] ./src sync 160 bytes {server} [built]
[buffer] external "buffer" 42 bytes {server} [built]
[crypto] external "crypto" 42 bytes {server} [built]
[events] external "events" 42 bytes {server} [built]
[fs] external "fs" 42 bytes {server} [built]
[http] external "http" 42 bytes {server} [built]
[https] external "https" 42 bytes {server} [built]
[net] external "net" 42 bytes {server} [built]
[os] external "os" 42 bytes {server} [built]
[path] external "path" 42 bytes {server} [built]
[timers] external "timers" 42 bytes {server} [optional] [built]
[url] external "url" 42 bytes {server} [built]
+ 587 hidden modules
WARNING in ./node_modules/#angular/core/fesm5/core.js 17170:15-36
System.import() is deprecated and will be removed soon. Use import()
instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# ./server.ts 6:13-37
WARNING in ./node_modules/#angular/core/fesm5/core.js 17182:15-102
System.import() is deprecated and will be removed soon. Use import() instead.
For more info visit https://webpack.js.org/guides/code-splitting/
# ./server.ts 6:13-37
Late answer but better late then never...
It's an old package xhr2 used by webpack-cli, there is an open issue on github.
To solve the issue follow the suggestion on that tread: npm i xhr2 --save

Deploy Nodejs+Express+React+Webpack app on heroku

I have made a web app using node js, express, webpack, react and socket io and I would like to deploy it on heroku. When I try it I can access to the website but it shows me an error message:
Cannot GET /
Here is my configuration:
"scripts": {
"start": "npm run dev",
"build": "webpack --mode production",
"client": "webpack-dev-server --mode development --devtool inline-source-map --hot",
"server": "nodemon src/server/index.js",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install && npm run build"
}
The start script was node src/server/index.js before I change it because I run npm run dev to start my app locally.
Here is my repository: http://git.kamal-allali.fr/kamal/prog_web_5a
Here is the heroku link: https://fast-earth-60949.herokuapp.com
Here are the heroku logs:
2018-11-05T21:42:44.984679+00:00 app[web.1]: 1 Built at: 11/05/2018 9:42:44 PM
2018-11-05T21:42:44.984681+00:00 app[web.1]: 1 Asset
Size Chunks Chunk Names
2018-11-05T21:42:44.984683+00:00 app[web.1]: 1 bundle.js 7.42
MiB main [emitted] main
2018-11-05T21:42:44.984685+00:00 app[web.1]: 1 favicon.ico 40.4
KiB [emitted]
2018-11-05T21:42:44.984686+00:00 app[web.1]: 1 index.html 717
bytes [emitted]
2018-11-05T21:42:44.984688+00:00 app[web.1]: 1 Entrypoint main =
bundle.js
2018-11-05T21:42:44.984710+00:00 app[web.1]: 1
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
2018-11-05T21:42:44.984712+00:00 app[web.1]: 1
[./node_modules/react-dom/index.js] 1.33 KiB {main} [built]
2018-11-05T21:42:44.984713+00:00 app[web.1]: 1
[./node_modules/react/index.js] 190 bytes {main} [built]
2018-11-05T21:42:44.984715+00:00 app[web.1]: 1
[./node_modules/url/url.js] 22.8 KiB {main} [built]
2018-11-05T21:42:44.984718+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/index.js?http://localhost:3000]
(webpack)-dev-server/client?http://localhost:3000 7.78 KiB {main}
[built]
2018-11-05T21:42:44.984720+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/overlay.js]
(webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
2018-11-05T21:42:44.984723+00:00 app[web.1]: 1 [0] multi
(webpack)-dev-server/client?http://localhost:3000
(webpack)/hot/dev-server.js ./src/client/index.js 52 bytes {main}
[built]
2018-11-05T21:42:44.984724+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/socket.js]
(webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
2018-11-05T21:42:44.984726+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js]
(webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {main}
[built]
2018-11-05T21:42:44.984728+00:00 app[web.1]: 1
[./node_modules/webpack/hot sync ^./log$] (webpack)/hot sync
nonrecursive ^./log$ 170 bytes {main} [built]
2018-11-05T21:42:44.984730+00:00 app[web.1]: 1
[./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js
1.61 KiB {main} [built]
2018-11-05T21:42:44.984732+00:00 app[web.1]: 1
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75
bytes {main} [built]
2018-11-05T21:42:44.984733+00:00 app[web.1]: 1
[./node_modules/webpack/hot/log-apply-result.js]
(webpack)/hot/log-apply-result.js 1.27 KiB {main} [built]
2018-11-05T21:42:44.984735+00:00 app[web.1]: 1
[./src/client/Layout.js] 4.33 KiB {main} [built]
2018-11-05T21:42:44.984736+00:00 app[web.1]: 1
[./src/client/index.js] 205 bytes {main} [built]
2018-11-05T21:42:44.984738+00:00 app[web.1]: 1 + 349 hidden
modules
2018-11-05T21:42:44.984740+00:00 app[web.1]: 1 Child
html-webpack-plugin for "index.html":
2018-11-05T21:42:44.984742+00:00 app[web.1]: 1 1 asset
2018-11-05T21:42:44.984743+00:00 app[web.1]: 1 Entrypoint
undefined = index.html
2018-11-05T21:42:44.984745+00:00 app[web.1]: 1
[./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html]
828 bytes {0} [built]
2018-11-05T21:42:44.984746+00:00 app[web.1]: 1
[./node_modules/lodash/lodash.js] 527 KiB {0}
[built]2018-11-05T21:42:44.984748+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js
489 bytes {0} [built]
2018-11-05T21:42:44.984749+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js
497 bytes {0} [built]
2018-11-05T21:42:44.984751+00:00 app[web.1]: 1 ℹ 「wdm」: Compiled
successfully.
2018-11-05T22:16:20.551630+00:00 heroku[web.1]: Idling
2018-11-05T22:16:20.552092+00:00 heroku[web.1]: State changed from up
to down
2018-11-05T22:16:21.411951+00:00 heroku[web.1]: Stopping all processes
with SIGTERM
2018-11-05T22:16:21.808625+00:00 heroku[web.1]: Process exited with
status 143
2018-11-06T08:35:42.000000+00:00 app[api]: Build started by user
kamal.allali#outlook.fr
2018-11-06T08:36:36.888512+00:00 heroku[web.1]: State changed from
down to starting
2018-11-06T08:36:36.713630+00:00 app[api]: Deploy d62783d3 by user
kamal.allali#outlook.fr
2018-11-06T08:36:36.713630+00:00 app[api]: Release v12 created by user
kamal.allali#outlook.fr
2018-11-06T08:36:40.000000+00:00 app[api]: Build succeeded
2018-11-06T08:36:42.010068+00:00 heroku[web.1]: Starting process with
command npm start
2018-11-06T08:36:45.324322+00:00 app[web.1]:
2018-11-06T08:36:45.324353+00:00 app[web.1]: > projet-web-5a#1.0.0
start /app
2018-11-06T08:36:45.324355+00:00 app[web.1]: > npm run dev
2018-11-06T08:36:45.324356+00:00 app[web.1]:
2018-11-06T08:36:45.753063+00:00 app[web.1]:
2018-11-06T08:36:45.753112+00:00 app[web.1]: > projet-web-5a#1.0.0 dev
/app
2018-11-06T08:36:45.753114+00:00 app[web.1]: > concurrently "npm run
server" "npm run client"
2018-11-06T08:36:45.753116+00:00 app[web.1]:
2018-11-06T08:36:47.147860+00:00 app[web.1]: 1
2018-11-06T08:36:47.147877+00:00 app[web.1]: 1 > projet-web-5a#1.0.0
client /app
2018-11-06T08:36:47.147879+00:00 app[web.1]: 1 > webpack-dev-server
--mode development --devtool inline-source-map --hot
2018-11-06T08:36:47.147881+00:00 app[web.1]: 1
2018-11-06T08:36:47.172481+00:00 app[web.1]: [0]
2018-11-06T08:36:47.172485+00:00 app[web.1]: [0] > projet-web-5a#1.0.0
server /app
2018-11-06T08:36:47.172487+00:00 app[web.1]: [0] > nodemon
src/server/index.js
2018-11-06T08:36:47.172488+00:00 app[web.1]: [0]
2018-11-06T08:36:47.672353+00:00 app[web.1]: [0] [nodemon] 1.18.4
2018-11-06T08:36:47.673281+00:00 app[web.1]: [0] [nodemon] to restart
at any time, enter rs
2018-11-06T08:36:47.673747+00:00 app[web.1]: [0] [nodemon] watching:
/app/src/server/**/*
2018-11-06T08:36:47.674424+00:00 app[web.1]: [0] [nodemon] starting
node src/server/index.js
2018-11-06T08:36:47.963706+00:00 app[web.1]: [0] Listening on port
45437
2018-11-06T08:36:48.299567+00:00 heroku[web.1]: State changed from
starting to up
2018-11-06T08:36:48.679674+00:00 app[web.1]: 1 clean-webpack-plugin:
/app/dist has been removed.
2018-11-06T08:36:48.905698+00:00 app[web.1]: 1 ℹ 「wds」: Project is
running at http://localhost:3000/
2018-11-06T08:36:48.906031+00:00 app[web.1]: 1 ℹ 「wds」: webpack
output is served from /
2018-11-06T08:36:48.956210+00:00 app[web.1]: 1 ⚠ 「wds」: Unable to
open browser. If you are running in a headless environment, please do
not use the --open flag
2018-11-06T08:36:55.276089+00:00 heroku[router]: at=info method=GET
path="/" host=fast-earth-60949.herokuapp.com
request_id=2474b83b-65ce-43b4-a54f-6851d5f55a7c fwd="78.112.168.129"
dyno=web.1 connect=0ms service=9ms status=404 bytes=360 protocol=https
2018-11-06T08:36:57.303048+00:00 app[web.1]: 1 ℹ 「wdm」: Hash:
6de9947fac0c16b70883
2018-11-06T08:36:57.303058+00:00 app[web.1]: 1 Version: webpack
4.19.1
2018-11-06T08:36:57.303061+00:00 app[web.1]: 1 Time: 8512ms
2018-11-06T08:36:57.303063+00:00 app[web.1]: 1 Built at: 11/06/2018
8:36:57 AM
2018-11-06T08:36:57.303066+00:00 app[web.1]: 1 Asset
Size Chunks Chunk Names
2018-11-06T08:36:57.303069+00:00 app[web.1]: 1 bundle.js 7.42
MiB main [emitted] main
2018-11-06T08:36:57.303071+00:00 app[web.1]: 1 favicon.ico 40.4
KiB [emitted]
2018-11-06T08:36:57.303073+00:00 app[web.1]: 1 index.html 717
bytes [emitted]
2018-11-06T08:36:57.303074+00:00 app[web.1]: 1 Entrypoint main =
bundle.js
2018-11-06T08:36:57.303077+00:00 app[web.1]: 1
[./node_modules/loglevel/lib/loglevel.js] 7.68 KiB {main} [built]
2018-11-06T08:36:57.303078+00:00 app[web.1]: 1
[./node_modules/react-dom/index.js] 1.33 KiB {main} [built]
2018-11-06T08:36:57.303080+00:00 app[web.1]: 1
[./node_modules/react/index.js] 190 bytes {main} [built]
2018-11-06T08:36:57.303082+00:00 app[web.1]: 1
[./node_modules/url/url.js] 22.8 KiB {main} [built]
2018-11-06T08:36:57.303084+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/index.js?http://localhost:3000]
(webpack)-dev-server/client?http://localhost:3000 7.78 KiB {main}
[built]
2018-11-06T08:36:57.303087+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/overlay.js]
(webpack)-dev-server/client/overlay.js 3.58 KiB {main} [built]
2018-11-06T08:36:57.303090+00:00 app[web.1]: 1 [0] multi
(webpack)-dev-server/client?http://localhost:3000
(webpack)/hot/dev-server.js ./src/client/index.js 52 bytes {main}
[built]
2018-11-06T08:36:57.303091+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/client/socket.js]
(webpack)-dev-server/client/socket.js 1.05 KiB {main} [built]
2018-11-06T08:36:57.303093+00:00 app[web.1]: 1
[./node_modules/webpack-dev-server/node_modules/strip-ansi/index.js]
(webpack)-dev-server/node_modules/strip-ansi/index.js 161 bytes {main}
[built]
2018-11-06T08:36:57.303095+00:00 app[web.1]: 1
[./node_modules/webpack/hot sync ^./log$] (webpack)/hot sync
nonrecursive ^./log$ 170 bytes {main} [built]
2018-11-06T08:36:57.303099+00:00 app[web.1]: 1
[./node_modules/webpack/hot/dev-server.js] (webpack)/hot/dev-server.js
1.61 KiB {main} [built]
2018-11-06T08:36:57.303100+00:00 app[web.1]: 1
[./node_modules/webpack/hot/emitter.js] (webpack)/hot/emitter.js 75
bytes {main} [built]
2018-11-06T08:36:57.303102+00:00 app[web.1]: 1
[./node_modules/webpack/hot/log-apply-result.js]
(webpack)/hot/log-apply-result.js 1.27 KiB {main} [built]
2018-11-06T08:36:57.303104+00:00 app[web.1]: 1
[./src/client/Layout.js] 4.33 KiB {main} [built]
2018-11-06T08:36:57.303106+00:00 app[web.1]: 1
[./src/client/index.js] 205 bytes {main} [built]
2018-11-06T08:36:57.303108+00:00 app[web.1]: 1 + 349 hidden
modules
2018-11-06T08:36:57.303109+00:00 app[web.1]: 1 Child
html-webpack-plugin for "index.html":
2018-11-06T08:36:57.303111+00:00 app[web.1]: 1 1 asset
2018-11-06T08:36:57.303113+00:00 app[web.1]: 1 Entrypoint
undefined = index.html
2018-11-06T08:36:57.303115+00:00 app[web.1]: 1
[./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html]
828 bytes {0} [built]
2018-11-06T08:36:57.303116+00:00 app[web.1]: 1
[./node_modules/lodash/lodash.js] 527 KiB {0}
[built]2018-11-06T08:36:57.303118+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js
489 bytes {0} [built]
2018-11-06T08:36:57.303119+00:00 app[web.1]: 1
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js
497 bytes {0} [built]
2018-11-06T08:36:57.303457+00:00 app[web.1]: 1 ℹ 「wdm」: Compiled
successfully.
You need to add your node version to your package.json.
Example:
"engines": {
"node": "10.11.0"
}
I answered in the comments but it is not the best way so I'll edit here.
Since you are trying to serve static content try with the static middleware.
Remove
app.get('*', (req,res) =>{
res.sendFile(path.join(__dirname,'../../public/index.html'));
});
And add
app.use(express.static(path.join(__dirname,'../../public')));
Second edit.
You need to build your project and serve the folder, usually is a dist or build folder.
To do this you have a couple of options, one is to build the project before publishing your changes to heroku but it can get a bit tedious.
The other option is to do a postinstall script so after heroku executes npm install the project gets built and the dist or build folder created with the latest changes.
"postinstall": "npm run build"
If you don't want the script to run everytime you do npm install you can use if-env with an environtment variable in heroku.
"postinstall": "if-env NODE_ENV=production && npm run build"
Once you know what folder is being created when building change the next line.
app.use(express.static(path.join(__dirname,'path to the folder with the prod build')));
Without the Heroku logs, its kinda of a speculation...BUT
Cannot GET / - means express is not answering to the path..
Heroku is serving NodeJs using express and thats where the bug should be
From checking the code in server/index.js you are using path package and forgot to import it :)
const path = require('path');
Once you fix that you will also need to add a condition to reach DIST folder and not public (As you will be serving the DIST folder)
if (process.env.NODE_ENV === 'production') {
app.use(express.static(path.join(__dirname, 'build')));
app.get('*', function (req, res) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
}
*Also check dist is loading and is not on .gitignore
Good luck!

Webpack returns error in CI - TS2688: Cannot find type definition file for 'reflect-metadata'

I have a simple nodejs dictionary application that use webpack for client side module management and concatination of scripts. Everything works fine in my local machine. Now I am doing some experiments with CI in Azure. During this experiments with Azure's continous delivery options using CI from visualstudio.com, I have encounter the following error when executing webpack task (I am using the webpack task from the marketplace). Can anyone help me out?
The webpack build task specific log file says:
2017-07-31T13:44:16.2307812Z ##[section]Starting: webpack
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.2307812Z Task : webpack
2017-07-31T13:44:16.2307812Z Description : bundle your assets, scripts, images, styles
2017-07-31T13:44:16.2307812Z Version : 3.0.19
2017-07-31T13:44:16.2307812Z Author : Dealogic
2017-07-31T13:44:16.2307812Z Help : [More information](https://marketplace.visualstudio.com/items?itemName=Dealogic.webpack-vsts-extension) [webpack](https://webpack.github.io/)
2017-07-31T13:44:16.2307812Z ==============================================================================
2017-07-31T13:44:16.4428024Z webpack
2017-07-31T13:44:16.4447837Z webpackConfigLocation: ./webpack.browser.config.js
2017-07-31T13:44:16.4447837Z treatErrorsAs: warnings
2017-07-31T13:44:16.4447837Z treatWarningsAs: warnings
2017-07-31T13:44:16.4447837Z workingFolder: d:\a\1\s
2017-07-31T13:44:16.4447837Z webpackModuleLocation: null
2017-07-31T13:44:16.4457843Z webpack module resolution started
2017-07-31T13:44:16.7987854Z webpack module resolution finished
2017-07-31T13:44:16.7987854Z webpack config resolution started
2017-07-31T13:44:16.7997851Z webpack config resolution finished
2017-07-31T13:44:16.7997851Z compilation of the webpack project is started
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:17.3707894Z [at-loader] Using typescript#2.4.2 from typescript and "tsconfig.json" from d:\a\1\s\client\tsconfig.json.
2017-07-31T13:44:17.3707894Z
2017-07-31T13:44:19.1378300Z
2017-07-31T13:44:19.1378300Z [at-loader] Checking started in a separate process...
2017-07-31T13:44:19.5368391Z
2017-07-31T13:44:19.5368391Z [at-loader] Checking finished with 1 errors
2017-07-31T13:44:19.5428397Z compilation of the webpack project is done
2017-07-31T13:44:19.5498387Z Hash: 1f80fddb56bf16ebb0f6
2017-07-31T13:44:19.5498387Z Version: webpack 3.4.1
2017-07-31T13:44:19.5498387Z Time: 2631ms
2017-07-31T13:44:19.5498387Z Asset Size Chunks Chunk Names
2017-07-31T13:44:19.5498387Z app-bundle.js 146 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z app-bundle.js.map 179 kB 0 [emitted] main
2017-07-31T13:44:19.5498387Z [4] ./node_modules/inversify/lib/annotation/decorator_utils.js 2.56 kB {0} [built]
2017-07-31T13:44:19.5498387Z [5] ./node_modules/inversify/lib/utils/guid.js 352 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [7] ./node_modules/inversify/lib/inversify.js 1.93 kB {0} [built]
2017-07-31T13:44:19.5498387Z [8] ./client/src/Dependency/DependencyIdentifiers.js 395 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [11] ./node_modules/reflect-metadata/Reflect.js 48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [14] ./node_modules/inversify/lib/syntax/constraint_helpers.js 1.48 kB {0} [built]
2017-07-31T13:44:19.5498387Z [15] ./node_modules/inversify/lib/planning/metadata_reader.js 962 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [16] ./client/src/index.ts 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [17] ./client/src/Dependency/DependencyManager.js 983 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [18] ./client/src/Services/WordFetcherImpl.js 2.18 kB {0} [built]
2017-07-31T13:44:19.5498387Z [45] ./node_modules/inversify/lib/annotation/post_construct.js 722 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [46] ./node_modules/process/browser.js 5.42 kB {0} [built]
2017-07-31T13:44:19.5498387Z [48] ./client/src/Utils/UriUtils.js 356 bytes {0} [built]
2017-07-31T13:44:19.5498387Z [49] ./client/src/Services/OxfordHelper.js 1.29 kB {0} [built]
2017-07-31T13:44:19.5498387Z [50] ./client/src/Services/DictionaryService.js 2.13 kB {0} [built]
2017-07-31T13:44:19.5498387Z + 36 hidden modules
2017-07-31T13:44:19.5498387Z
2017-07-31T13:44:19.5498387Z ERROR in [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z ##[warning]webpack partially succeeded
2017-07-31T13:44:19.5568407Z ##[warning]webpack: [at-loader] TS2688: Cannot find type definition file for 'reflect-metadata'.
2017-07-31T13:44:19.5568407Z webpack summary section markdown file creation is started
2017-07-31T13:44:19.5568407Z webpack sumamry section markdown file is created with the name 'd:\a\1\s\webpack.webpack.result.md'
2017-07-31T13:44:20.0895996Z ##[section]Finishing: webpack
Here is the dependencies fragment from the package.json
"dependencies": {
"async": "^2.5.0",
"compression": "^1.7.0",
"express": "^4.15.3",
"inversify": "^4.2.0",
"reflect-metadata": "^0.1.10",
"request": "^2.81.0"
},
"devDependencies": {
"#types/async": "^2.0.40",
"#types/compression": "0.0.33",
"#types/express": "^4.0.36",
"#types/jasmine": "^2.5.53",
"#types/node": "^8.0.14",
"#types/request": "^2.0.0",
"awesome-typescript-loader": "^3.2.1",
"jasmine": "^2.6.0",
"jasmine-console-reporter": "^1.2.7",
"typescript": "*",
"typings": "^2.1.1",
"webpack": "^3.0.0"
}
What could be wrong?
Try installing reflect-metadata #types: https://www.npmjs.com/package/#types/reflect-metadata
npm i -D #types/reflect-metadata
Maybe you should add it on tsconfig.json, depends on your current configuration.
It was more of a MS TFS issue. When I changed Agent from "Hosted VS2017" to "Hosted Linux Preview" everything worked fine!
Not sure what is going on under the hood.

Resources