Node.JS app crash on startup after second deployment on Heroku - node.js

I did git push heroku master for the second time.
But I got the error cannot find module ....
For the first time, I succeeded.
How can I fix this? Thanks.
2021-01-03T16:03:35.301824+00:00 app[web.1]: internal/modules/cjs/loader.js:818
2021-01-03T16:03:35.301837+00:00 app[web.1]: throw err;
2021-01-03T16:03:35.301837+00:00 app[web.1]: ^
2021-01-03T16:03:35.301837+00:00 app[web.1]:
2021-01-03T16:03:35.301838+00:00 app[web.1]: Error: Cannot find module './stringToParts'
2021-01-03T16:03:35.301838+00:00 app[web.1]: Require stack:
2021-01-03T16:03:35.301839+00:00 app[web.1]: - /app/node_modules/mpath/lib/index.js
2021-01-03T16:03:35.301839+00:00 app[web.1]: - /app/node_modules/mpath/index.js
2021-01-03T16:03:35.301839+00:00 app[web.1]: - /app/node_modules/mongoose/lib/utils.js
2021-01-03T16:03:35.301840+00:00 app[web.1]: - /app/node_modules/mongoose/lib/statemachine.js
2021-01-03T16:03:35.301841+00:00 app[web.1]: - /app/node_modules/mongoose/lib/internal.js
2021-01-03T16:03:35.301841+00:00 app[web.1]: - /app/node_modules/mongoose/lib/document.js
2021-01-03T16:03:35.301841+00:00 app[web.1]: - /app/node_modules/mongoose/lib/index.js
2021-01-03T16:03:35.301842+00:00 app[web.1]: - /app/node_modules/mongoose/index.js
2021-01-03T16:03:35.301842+00:00 app[web.1]: - /app/models/user.js
2021-01-03T16:03:35.301843+00:00 app[web.1]: - /app/controllers/usersController.js
2021-01-03T16:03:35.301843+00:00 app[web.1]: - /app/routes/userRoutes.js
2021-01-03T16:03:35.301844+00:00 app[web.1]: - /app/routes/index.js
2021-01-03T16:03:35.301845+00:00 app[web.1]: - /app/main.js
2021-01-03T16:03:35.301845+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
2021-01-03T16:03:35.301846+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
2021-01-03T16:03:35.301846+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19)
2021-01-03T16:03:35.301847+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2021-01-03T16:03:35.301847+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/mpath/lib/index.js:1:21)
2021-01-03T16:03:35.301848+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:999:30)
2021-01-03T16:03:35.301848+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
2021-01-03T16:03:35.301849+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:863:32)
2021-01-03T16:03:35.301849+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:708:14)
2021-01-03T16:03:35.301849+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:887:19) {
2021-01-03T16:03:35.301850+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2021-01-03T16:03:35.301850+00:00 app[web.1]: requireStack: [
2021-01-03T16:03:35.301851+00:00 app[web.1]: '/app/node_modules/mpath/lib/index.js',
2021-01-03T16:03:35.301851+00:00 app[web.1]: '/app/node_modules/mpath/index.js',
2021-01-03T16:03:35.301851+00:00 app[web.1]: '/app/node_modules/mongoose/lib/utils.js',
2021-01-03T16:03:35.301852+00:00 app[web.1]: '/app/node_modules/mongoose/lib/statemachine.js',
2021-01-03T16:03:35.301852+00:00 app[web.1]: '/app/node_modules/mongoose/lib/internal.js',
2021-01-03T16:03:35.301852+00:00 app[web.1]: '/app/node_modules/mongoose/lib/document.js',
2021-01-03T16:03:35.301853+00:00 app[web.1]: '/app/node_modules/mongoose/lib/index.js',
2021-01-03T16:03:35.301853+00:00 app[web.1]: '/app/node_modules/mongoose/index.js',
2021-01-03T16:03:35.301853+00:00 app[web.1]: '/app/models/user.js',
2021-01-03T16:03:35.301854+00:00 app[web.1]: '/app/controllers/usersController.js',
2021-01-03T16:03:35.301854+00:00 app[web.1]: '/app/routes/userRoutes.js',
2021-01-03T16:03:35.301855+00:00 app[web.1]: '/app/routes/index.js',
2021-01-03T16:03:35.301855+00:00 app[web.1]: '/app/main.js'
2021-01-03T16:03:35.301855+00:00 app[web.1]: ]
2021-01-03T16:03:35.301856+00:00 app[web.1]: }
2021-01-03T16:03:35.394395+00:00 heroku[web.1]: Process exited with status 1
2021-01-03T16:03:35.475189+00:00 heroku[web.1]: State changed from starting to crashed
2021-01-03T16:03:35.479175+00:00 heroku[web.1]: State changed from crashed to starting
2021-01-03T16:03:39.720428+00:00 heroku[web.1]: Starting process with command `node main.js`

Are you exporting the data in './stringToParts' correctly?
When you require a module like './stringToParts', it must be exported.
Check if you have something like this at the end of your './stringToParts' file:
module.exports = function;

Related

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''

What supposed to be the problem? all of the sudden when i npm run dev, my app did not work anymore.
error:
[nodemon] 2.0.19
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node server.js`
node:internal/modules/cjs/loader:1000
throw new ERR_INVALID_ARG_VALUE('id', id,
^
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'id' must be a non-empty string. Received ''
at new NodeError (node:internal/errors:371:5)
at Module.require (node:internal/modules/cjs/loader:1000:11)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Node\express graphQL\server.js:7:14)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'ERR_INVALID_ARG_VALUE'
}
[nodemon] app crashed - waiting for file changes before starting...
Sorry, I forgot to remove this line:
const test = require("");
Now, working fine

MODULE not found error with nodeJs app on heroku

I am trying to deploy my project on heroku but receiving module not found error.It took my 3 days and I still do not know the exact reason.Please help me.
2022-06-10T14:24:19.535051+00:00 app[web.1]: requireStack: [
2022-06-10T14:24:19.535051+00:00 app[web.1]: '/app/node_modules/mongoose/lib/helpers/cursor/eachAsync.js',
2022-06-10T14:24:19.535051+00:00 app[web.1]: '/app/node_modules/mongoose/lib/cursor/QueryCursor.js',
2022-06-10T14:24:19.535052+00:00 app[web.1]: '/app/node_modules/mongoose/lib/query.js',
2022-06-10T14:24:19.535052+00:00 app[web.1]: '/app/node_modules/mongoose/lib/index.js',
2022-06-10T14:24:19.535052+00:00 app[web.1]: '/app/node_modules/mongoose/index.js',
2022-06-10T14:24:19.535052+00:00 app[web.1]: '/app/server.js'
2022-06-10T14:24:19.535052+00:00 app[web.1]: ]
2022-06-10T14:24:19.535053+00:00 app[web.1]: }
2022-06-10T14:24:19.535057+00:00 app[web.1]:
2022-06-10T14:24:19.535057+00:00 app[web.1]: Node.js v18.3.0
2022-06-10T14:24:19.727936+00:00 heroku[web.1]: Process exited with status 1
2022-06-10T14:24:19.798623+00:00 heroku[web.1]: State changed from starting to crashed
2022-06-10T15:00:50.000000+00:00 app[api]: Build started by user bakhtiyorjondadajonov#gmail.com
2022-06-10T15:01:37.186809+00:00 heroku[web.1]: State changed from crashed to starting
2022-06-10T15:01:43.232647+00:00 heroku[web.1]: Starting process with command `npm start`
2022-06-10T15:01:45.131815+00:00 app[web.1]:
2022-06-10T15:01:45.131826+00:00 app[web.1]: > starter-natours#1.0.0 start
2022-06-10T15:01:45.131826+00:00 app[web.1]: > node server.js
2022-06-10T15:01:45.131827+00:00 app[web.1]:
2022-06-10T15:01:45.362540+00:00 app[web.1]: node:internal/modules/cjs/loader:942
2022-06-10T15:01:45.362541+00:00 app[web.1]: throw err;
2022-06-10T15:01:45.362542+00:00 app[web.1]: ^
2022-06-10T15:01:45.362542+00:00 app[web.1]:
2022-06-10T15:01:45.362542+00:00 app[web.1]: Error: Cannot find module '../../error/eachAsyncMultiError'
2022-06-10T15:01:45.362543+00:00 app[web.1]: Require stack:
2022-06-10T15:01:45.362543+00:00 app[web.1]: - /app/node_modules/mongoose/lib/helpers/cursor/eachAsync.js
2022-06-10T15:01:45.362543+00:00 app[web.1]: - /app/node_modules/mongoose/lib/cursor/QueryCursor.js
2022-06-10T15:01:45.362544+00:00 app[web.1]: - /app/node_modules/mongoose/lib/query.js
2022-06-10T15:01:45.362544+00:00 app[web.1]: - /app/node_modules/mongoose/lib/index.js
2022-06-10T15:01:45.362544+00:00 app[web.1]: - /app/node_modules/mongoose/index.js
2022-06-10T15:01:45.362545+00:00 app[web.1]: - /app/server.js

my npm refused to install and i entered "npm config unsafe-perm true" and now i receive this error when trying to install

node:fs:723
handleErrorFromBinding(ctx);
^
Error: EIO: i/o error, read
at Object.readSync (node:fs:723:3)
at tryReadSync (node:fs:433:20)
at Object.readFileSync (node:fs:471:19)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Program Files\nodejs\node_modules\npm\lib\utils\exit-handler.js:4:22)
at Module._compile (node:internal/modules/cjs/loader:1103:14) {
errno: -4070,
syscall: 'read',
code: 'EIO'
}

npx create-react-app fails with error "cannot find module block-stream

$ npx create-react-app counter
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'block-stream'
Require stack:
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\tar\lib\entry-writer.js
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\tar\lib\pack.js
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\tar\tar.js
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\create-react-app\node_modules\tar-pack\index.js
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js
C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\create-react-app\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\theop\AppData\Local\npm-cache_npx\c67e74de0542c87c\node_modules\tar\lib\entry-writer.js:7:19)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\tar\lib\entry-writer.js',
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\tar\lib\pack.js',
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\tar\tar.js',
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\node_modules\tar-pack\index.js',
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\createReactApp.js',
'C:\Users\theop\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app\index.js'
]
}
I thought you installed block-stream first
npm init && npm i block-stream && npx create-react-app counter
or using vite
npm create vite#latest my-vue-app -- --template react

Heroku App Crashing with Syntax Error for Hoek

I'm trying to build the Slack app found here: https://github.com/shaykalyan/slack-ascii
It builds successfully, but gives this output when I try to run it:
2018-02-14T16:21:18.323723+00:00 heroku[web.1]: Starting process with command `node index.js`
2018-02-14T16:21:20.151317+00:00 heroku[web.1]: State changed from starting to crashed
2018-02-14T16:21:20.137708+00:00 heroku[web.1]: Process exited with status 1
2018-02-14T16:21:20.085005+00:00 app[web.1]: /app/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
2018-02-14T16:21:20.085023+00:00 app[web.1]: const Hoek = require('hoek');
2018-02-14T16:21:20.085025+00:00 app[web.1]: ^^^^^
2018-02-14T16:21:20.085027+00:00 app[web.1]: SyntaxError: Use of const in strict mode.
2018-02-14T16:21:20.085028+00:00 app[web.1]: at exports.runInThisContext (vm.js:73:16)
2018-02-14T16:21:20.085030+00:00 app[web.1]: at Module._compile (module.js:443:25)
2018-02-14T16:21:20.085032+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)
2018-02-14T16:21:20.085034+00:00 app[web.1]: at Module.load (module.js:355:32)
2018-02-14T16:21:20.085035+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2018-02-14T16:21:20.085037+00:00 app[web.1]: at Module.require (module.js:365:17)
2018-02-14T16:21:20.085038+00:00 app[web.1]: at require (module.js:384:17)
2018-02-14T16:21:20.085040+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/request/node_modules/hawk/lib/index.js:5:33)
2018-02-14T16:21:20.085042+00:00 app[web.1]: at Module._compile (module.js:460:26)
2018-02-14T16:21:20.085043+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)

Resources