Too many errors - heroku

This is the error I start with:
npm ERR! missing script: start
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2020-08-10T10_15_35_198-debug.log
then continues from this
State changed from crashing to starting
Starting process with command `node idex.js`
State changed from starting to up
Process exited with status 1
State changed from up to crashed
still...
ReferenceError: client is not defined
at Object.<anonymous> (/app/music.js:10:1)
at Module._compile (internal/modules/cjs/loader.js:1137:20)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:100
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/app/index.js:9:11)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
What should I do?

missing script: start
You're probably using npm start [script].
You need to configure your package.json "scripts" object.
It requires a "start": "your/file" in the "scripts" object, to start with.
Here's an example.
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon src/server.js",
"dev": "src/server.js"
}
client is not defined
In music.js, line 10, you have a variable client that hasn't seemed to be defined, thus it is unable to access it.
All this leads to your file being unable to start and crashing constantly, which is shown in your second image.

Related

SyntaxError Unexpected token in Cypress

I am trying to setup Cypress in my laptop, but I get this error when I try to execute the example tests. I tried to clear the cypress cache and reinstall cypress, but got the same error. here is screen shot of what syntax error I receive when I hit "npm run test".
This is what I get in the terminal after I hit "npm run test"
C:\Users\u46827\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\#packages\server\lib\plugins\child\run_plugins.js:40
invoke = (eventId, args = []) => {
SyntaxError: Unexpected token =
at new Script (vm.js:79:7)
at createScript (vm.js:251:10)
at Object.runInThisContext (vm.js:303:10)
at Module._compile (internal/modules/cjs/loader.js:656:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\u46827\AppData\Local\Cypress\Cache\10.7.0\Cypress\resources\app\node_modules\#packages\server\lib\plugins\child\run_require_async_child.js:6:24)
at Module._compile (internal/modules/cjs/loader.js:688:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
at Module.load (internal/modules/cjs/loader.js:598:32)
at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
at Function.Module._load (internal/modules/cjs/loader.js:529:3)
[3544:0904/215759.289:ERROR:dns_config_service.cc(278)] DNS config watch failed.
Please open screenshot here
I found the issue. My node version was old. I updated it to 16

Truffle Drizzle Tutorial fails on last step 'npm run dev'

I am on windows 10, using vscode. Basically finished the petshop tutorial with no issues or problems using truffle.
when I enter the command npm run dev it fails as shown below.
PS Y:\code\petshop> npm run dev
> pet-shop#1.0.0 dev
> lite-server
internal/modules/cjs/loader.js:316
throw err;
^
Error: Cannot find module 'Y:\code\petshop\node_modules\immutable\dist\immutable'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:308:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:521:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:872:27)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Module.require (internal/modules/cjs/loader.js:957:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (Y:\code\petshop\node_modules\browser-sync\dist\hooks.js:3:17)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32) {
code: 'MODULE_NOT_FOUND',
path: 'Y:\\code\\petshop\\node_modules\\immutable\\package.json',
requestPath: 'immutable'
}
Not sure where to go from here, nothing works. This type of error is a bit beyond me. Any and all help is greatly appreciated.
EDIT: changed screenshot to code snippet. And I realized the problem is that the 'immutable' path is non-existent in my node_modules. Still not sure how to address this. tried a cheeky npm install immutable to no avail....

Lerna command in AWS Codebuild

Error: Cannot find module '.'
Require stack:
- /codebuild/output/src309915592/src/node_modules/.bin/lerna
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/codebuild/output/src309915592/src/node_modules/.bin/lerna:11:3)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/codebuild/output/src309915592/src/node_modules/.bin/lerna' ]
}
I get this error on running the test command:
lerna run --stream test --parallel
Also, tried with
lerna run --stream test --parallel --scope tenant-registration-service
In the services, test script looks like,
"test": "serverless-bundle test --verbose --coverage",
I installed Lerna globally in the pipeline. How do I debug this? What module is it not able to find? It looks like it already has lerna installed which it should.
npm run test command runs just fine on the local system.

RxJs-5-to-6-migrate crashes

I'm trying to update my project from Angular 4 to Angular 6.
I followed the update steps found on the Angular website and all goes quite smoothly.
However, when trying to use the rxjs-5-to-6-migrate script, it crashes.
I've tried various variations of paths, but noothing seems to work.
I've no idea what's going on...
PS D:\workspace\project> rxjs-5-to-6-migrate -p src/tsconfig.app.json
Running the automatic migrations. Please, be patient and wait until the execution completes.
child_process.js:615
throw err;
^
Error: Command failed: "d:\Applications\node-v9.11.1-win-x64\node_modules\rxjs-tslint\node_modules\.bin\tslint" -c "d:\Applications\node-v9.11.1-win-x64\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.json" -p "src/tsconfig.app.json" --fix
at checkExecSyncError (child_process.js:575:11)
at Object.execSync (child_process.js:612:13)
at migrate (d:\Applications\node-v9.11.1-win-x64\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:18:34)
at Object.<anonymous> (d:\Applications\node-v9.11.1-win-x64\node_modules\rxjs-tslint\rxjs-5-to-6-migrate.js:25:14)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
Apparently it was a outdated dependency (probably tslint) what caused this. After updating all dependencies in the package.json, it worked.

cannot find module 'mongdb' heroku mongoskin

My app is working find locally, but when deploying to heroku one of my modules can't be found. I used a .gitignore file to ignore the node_modules folder and allow heroku to install the proper dependencies. When i run the heroku open command and search the logs using heroku logs --tail it shows this error.
The error i get is:
2015-10-21T14:42:58.415140+00:00 app[web.1]: Error: Cannot find module 'mongodb'
2015-10-21T14:42:58.415141+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:336:15)
2015-10-21T14:42:58.415142+00:00 app[web.1]: at Function.Module._load (module.js:278:25)
2015-10-21T14:42:58.415142+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-21T14:42:58.415143+00:00 app[web.1]: at require (module.js:384:17)
2015-10-21T14:42:58.415144+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/mongoskin/lib/index.js:14:13)
2015-10-21T14:42:58.415145+00:00 app[web.1]: at Module._compile (module.js:460:26)
2015-10-21T14:42:58.415145+00:00 app[web.1]: at Object.Module._extensions..js (module.js:478:10)
2015-10-21T14:42:58.415146+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-10-21T14:42:58.415146+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-10-21T14:42:58.415147+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-21T14:42:59.337084+00:00 heroku[web.1]: Process exited with status 1
2015-10-21T14:42:59.348953+00:00 heroku[web.1]: State changed from starting to crashed
locally my app structure is as follows:
app/
config/
node_modules/
..
-mongodb
-mongoskin
..
public/
When I search the heroku directory using the bash I don't see the mongodb module. What could be the issue?
I've figured out the answer. I deleted the node_modules files locally and ran npm install again and node showed this warning:
npm WARN peerDependencies The peer dependency mongodb#~2.0 included from mongoskin will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
I had to declare the mongoskin dependency on mongodb explicitly in my package.json file for mongoskin direclty like this:
"dependencies": {
...
"mongoskin": "2.0.3",
"mongodb": "^2.0.46",
...
}
I pushed it to heroku and it worked.

Resources