How to deploy a nodejs app to heroku with github - javascript

i want to deploy this application https://github.com/thefailtheory/neofreelance i am developping on my http://livecoding.tv channel
to heroku but i am facing an error
the application is basic it will try to solve a problem on freelancing in the cloud i use everyday
here is the log :
2016-11-22T16:20:34.454131+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2016-11-22T16:20:34.454297+00:00 app[web.1]: npm ERR! neofreelance#1.0.0 start: `node app.js`
2016-11-22T16:20:34.454450+00:00 app[web.1]: npm ERR! Exit status 1
2016-11-22T16:20:34.454616+00:00 app[web.1]: npm ERR!
2016-11-22T16:20:34.454772+00:00 app[web.1]: npm ERR! Failed at the neofreelance#1.0.0 start script 'node app.js'.
2016-11-22T16:20:34.454931+00:00 app[web.1]: npm ERR! Make sure you have the latest version of node.js and npm installed.
2016-11-22T16:20:34.455081+00:00 app[web.1]: npm ERR! If you do, this is most likely a problem with the neofreelance package,
2016-11-22T16:20:34.455232+00:00 app[web.1]: npm ERR! not with npm itself.
2016-11-22T16:20:34.455378+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2016-11-22T16:20:34.455537+00:00 app[web.1]: npm ERR! node app.js
2016-11-22T16:20:34.455684+00:00 app[web.1]: npm ERR! You can get information on how to open an issue for this project with:
2016-11-22T16:20:34.455833+00:00 app[web.1]: npm ERR! npm bugs neofreelance
2016-11-22T16:20:34.456007+00:00 app[web.1]: npm ERR! Or if that isn't available, you can get their info via:
2016-11-22T16:20:34.456156+00:00 app[web.1]: npm ERR! npm owner ls neofreelance
2016-11-22T16:20:34.456302+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2016-11-22T16:20:34.459887+00:00 app[web.1]:
2016-11-22T16:20:34.460174+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2016-11-22T16:20:34.460356+00:00 app[web.1]: npm ERR! /app/npm-debug.log

That is because Block-scoped declarations (let, const) are not yet supported in the Node version Heroku is using outside of strict mode.
So two options:
Add "use strict"; at the beginning of your file
Use var and not let.

Related

I can't install puppeteer

I have a problem with install puppeteer.
I set Visual Code in firewall
When I write npm install puppeteer terminal show me this ERROR :
ERROR: Failed to set up Chromium r869685! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
Error: Download failed: server returned code 403. URL: https://storage.googleapis.com/chromium-browser-snapshots/Win/869685/chrome-win.zip
at D:\webs\scraper\node_modules\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:366:27
at ClientRequest.requestCallback (D:\webs\scraper\node_modules\puppeteer\lib\cjs\puppeteer\node\BrowserFetcher.js:492:13)
at Object.onceWrapper (events.js:483:26)
at ClientRequest.emit (events.js:376:20)
at HTTPParser.parserOnIncomingClient (_http_client.js:647:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
at TLSSocket.socketOnData (_http_client.js:515:22)
at TLSSocket.emit (events.js:376:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
npm WARN enoent ENOENT: no such file or directory, open 'D:\webs\scraper\package.json'
npm WARN scraper No description
npm WARN scraper No repository field.
npm WARN scraper No README data
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#9.1.1 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#9.1.1 install 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! C:\Users\AA\AppData\Roaming\npm-cache\_logs\2021-05-28T13_57_47_494Z-debug.log
Thanks for help.
Google is blocking you to download.
Try this :-
set environment variable PUPPETEER_DOWNLOAD_HOST to http://storage.googleapis.com

npm error while trying to install polymer

I am trying to test sensors using html and javascript like it's shown here but when I try to install polymer as it's written in the readme I get this error:
kupu#kupu:~/Dropbox/IOT/generic-sensor-demos/sensor-info$ npm install -g polymer-cli
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/kupu/.npm/_logs/2020-05-09T17_52_32_877Z-debug.log
And even if I try to run it as sudo I get this:
kupu#kupu:~/Dropbox/IOT/generic-sensor-demos/sensor-info$ sudo npm install -g polymer-cli
/usr/local/bin/polymer -> /usr/local/lib/node_modules/polymer-cli/bin/polymer.js
> wd#1.11.2 install /usr/local/lib/node_modules/polymer-cli/node_modules/wd
> node scripts/build-browser-scripts
/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:90
throw err0;
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/polymer-cli/node_modules/wd/build'
at Object.mkdirSync (fs.js:753:3)
at sync (/usr/local/lib/node_modules/polymer-cli/node_modules/mkdirp/index.js:71:13)
at Object.<anonymous> (/usr/local/lib/node_modules/polymer-cli/node_modules/wd/scripts/build-browser-scripts.js:6:1)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:283:19)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules/polymer-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wd#1.11.2 install: `node scripts/build-browser-scripts`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wd#1.11.2 install 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! /root/.npm/_logs/2020-05-09T17_53_02_303Z-debug.log
Is there a good soul out there that can help me?
You're having a typical npm EACCES permission issue. It has to do with your user not having permissions to modify the directory where npm is trying to store global packages. It can be very annoying. You should look here and see which solution fits you best: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
You can fix it with,
sudo npm install --unsafe-perm -g polymer-cli
Unsafe-perm flag is set to true to suppress User Identifier/ Group Identifier switching when running package scripts.The flag is explicitly set to false to prevent non-root user from installing packages.
You can also try to change ownership of node_modules,
To change ownership to current user as group -
sudo chown -R root: <YOUR_USERNAME>/usr/local/lib/node_modules/
sudo chmod -R 775 /usr/local/lib/node_modules/
And never use sudo for npm related query.

heroku logs sh: 1: concurrently: not found

2017-10-08T20:06:11.093118+00:00 heroku[web.1]: Starting process with command `npm start`
2017-10-08T20:06:15.431068+00:00 app[web.1]:
2017-10-08T20:06:15.431083+00:00 app[web.1]: > shopping-cart-app#0.1.0 start /app
2017-10-08T20:06:15.431084+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2017-10-08T20:06:15.439379+00:00 app[web.1]: sh: 1: concurrently: not found
2017-10-08T20:06:15.446591+00:00 app[web.1]: npm ERR! file sh
2017-10-08T20:06:15.431085+00:00 app[web.1]:
2017-10-08T20:06:15.447135+00:00 app[web.1]: npm ERR! errno ENOENT
2017-10-08T20:06:15.447368+00:00 app[web.1]: npm ERR! syscall spawn
2017-10-08T20:06:15.446893+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-10-08T20:06:15.453425+00:00 app[web.1]: npm ERR!
2017-10-08T20:06:15.448865+00:00 app[web.1]: npm ERR! shopping-cart-app#0.1.0 start: `concurrently "npm run server" "npm run client"`
2017-10-08T20:06:15.453636+00:00 app[web.1]: npm ERR! Failed at the shopping-cart-app#0.1.0 start script.
2017-10-08T20:06:15.464269+00:00 app[web.1]:
2017-10-08T20:06:15.453115+00:00 app[web.1]: npm ERR! spawn ENOENT
2017-10-08T20:06:15.453824+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-10-08T20:06:15.469282+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-10-08T20:06:15.469426+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-10-08T20_06_15_456Z-debug.log
2017-10-08T20:06:15.625015+00:00 heroku[web.1]: State changed from starting to crashed
2017-10-08T20:06:15.627831+00:00 heroku[web.1]: State changed from crashed to starting
2017-10-08T20:06:15.609086+00:00 heroku[web.1]: Process exited with status 1
2017-10-08T20:06:20.543684+00:00 heroku[web.1]: Starting process with command `npm start`
2017-10-08T20:06:23.048216+00:00 heroku[web.1]: Process exited with status 1
2017-10-08T20:06:22.944636+00:00 app[web.1]: > shopping-cart-app#0.1.0 start /app
2017-10-08T20:06:22.944621+00:00 app[web.1]:
2017-10-08T20:06:22.944637+00:00 app[web.1]: > concurrently "npm run server" "npm run client"
2017-10-08T20:06:22.944637+00:00 app[web.1]:
2017-10-08T20:06:22.951908+00:00 app[web.1]: sh: 1: concurrently: not found
2017-10-08T20:06:22.957587+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2017-10-08T20:06:22.957261+00:00 app[web.1]: npm ERR! file sh
2017-10-08T20:06:22.957843+00:00 app[web.1]: npm ERR! errno ENOENT
2017-10-08T20:06:22.959735+00:00 app[web.1]: npm ERR! spawn ENOENT
2017-10-08T20:06:22.958098+00:00 app[web.1]: npm ERR! syscall spawn
2017-10-08T20:06:22.959544+00:00 app[web.1]: npm ERR! shopping-cart-app#0.1.0 start: `concurrently "npm run server" "npm run client"`
2017-10-08T20:06:22.960008+00:00 app[web.1]: npm ERR!
2017-10-08T20:06:22.960225+00:00 app[web.1]: npm ERR! Failed at the shopping-cart-app#0.1.0 start script.
2017-10-08T20:06:22.966218+00:00 app[web.1]:
2017-10-08T20:06:22.966570+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2017-10-08T20_06_22_962Z-debug.log
2017-10-08T20:06:22.960452+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2017-10-08T20:06:22.966432+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2017-10-08T20:06:23.060706+00:00 heroku[web.1]: State changed from starting to crashed
I can run the app on my localhost but it crashes in heroku. It seems that I am having issues with the concurrently package while starting app in heroku. I used npm i -S concurrently but it downloads under dev dependancies. Is there some type of setting in Heroku that I need to change to use concurrently?
apt-get install nodejs-legacy
npm install -g tsc
npm install -g concurrently
npm install -g typescript
try this command

netcdf doesn't work in Node.js program

I'm trying to encode a NetCDF file in Node.js program, by using the netcdf(https://www.npmjs.com/package/netcdf) library.
Now, once I run a program, I get an error below.
C:\app [master +2 ~1 -0 !]> npm start
> spaceapps#1.0.0 start C:\app
> node server.js
C:\app\node_modules\text-encoding\lib\encoding.js:979
throw TypeError('Called as a function. Did you forget \'new\'?');
^
TypeError: Called as a function. Did you forget 'new'?
at TypeError (native)
at Object.TextDecoder (C:\app\node_modules\text-encoding\lib\encoding.js:979:13)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\readbinary.js:4:40)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (C:\app\node_modules\netcdf\util\type.js:4:14)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v\\nodev5.9.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v5.9.1
npm ERR! npm v3.8.7
npm ERR! code ELIFECYCLE
npm ERR! spaceapps#1.0.0 start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the spaceapps#1.0.0 start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the spaceapps package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs spaceapps
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls spaceapps
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\app\npm-debug.log
C:\app [master +3 ~1 -0 !]>
It seems there is an error in a library.
I appreciate if someone tells me a solution for it.
As the developer said, He has no plans in the short or medium term to continue development, so you could consider use netcdfjs, that it's a javascript library that allows to read NetCDF v3 files. Because it's a NodeJS package you can run it server side, and for regular size files you can read it online, here you have an example.

node js crypto.PBKDF2Sync behaves differently in Ubuntu 14.04

I recently switched to Ubuntu 14.04, and also worked on my Mac machine. This project is cloned from the same repo, but behaves differently on two machines. I have no clue why, please help me.
I used this line to hashed my password, and it works fine on my mac machine.
var hashed = crypto.pbkdf2Sync(entered,this.salt,12000,128).toString('hex');
However, in Ubuntu, it gives following errors:
> node ./bin/www
crypto.js:574
var ret = binding.PBKDF2(password, salt, iterations, keylen, digest);
^
TypeError: Not a buffer
at TypeError (native)
at pbkdf2 (crypto.js:574:23)
at Object.exports.pbkdf2Sync (crypto.js:553:10)
at model.<anonymous> (/media/linux/app/dataModel/userModel.js:30:33)
at _next (/media/linux/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:62:30)
at fnWrapper (/media/linux/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:186:18)
at model.Object.defineProperty.value.fn (/media/linux/app/node_modules/mongoose/lib/schema.js:215:9)
at _next (/media/linux/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:62:30)
at fnWrapper (/media/linux/app/node_modules/mongoose/node_modules/hooks-fixed/hooks.js:186:18)
at /media/linux/app/node_modules/mongoose/lib/schema.js:198:13
at complete (/media/linux/app/node_modules/mongoose/lib/document.js:1107:5)
at /media/linux/app/node_modules/mongoose/lib/document.js:1133:20
at ObjectId.SchemaType.doValidate (/media/linux/app/node_modules/mongoose/lib/schematype.js:645:22)
at /media/linux/app/node_modules/mongoose/lib/document.js:1129:9
at doNTCallback0 (node.js:407:9)
at process._tickCallback (node.js:336:13)
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! app#0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#0.0.0 start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the bocerapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /media/linux/app/npm-debug.log
Thanks in advance!

Categories

Resources