Apify - error in configuration of generated actor - node.js

I'm trying to run Apify locally, after installing all the packages, creating the actor and running it I got this:
Warning: You are not logged in with your Apify Account. Some features like Apify Proxy will not work. Call "apify login" to fix that.
Run: npm start
> test2#0.0.1 start
> node main.js
/home/a/test2/node_modules/apify/build/configuration.js:91
const envKey = Configuration.ENV_MAP_REVERSED[key] ?? key;
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/home/a/test2/node_modules/apify/build/events.js:10:25)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
npm ERR! code 1
npm ERR! path /home/a/test2
npm ERR! command failed
npm ERR! command sh -c node main.js
npm ERR! A complete log of this run can be found in:
npm ERR! /home/a/.npm/_logs/2022-02-08T18_28_58_177Z-debug.log
Error: npm exited with code 1
the version of npm is v12.22.5
Any ideas how to generate the correct config file? Thanks

You need Node.js 16+ for the latest SDK to work

Related

Error while deploying nodejs server on google cloud

seeking help for my personal project. My project is running perfectly on my localhost but when I try to deploy it on google cloud, it is giving me some sort of module error .
Here is the error i am receiving
Updating service [default] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Error Response: [9] An internal error occurred while processing task /app-engine-flex/flex_await_healthy/flex_await_healthy>2022-06-10T08:18:51.725Z29622.hc.2:
> buy-and-sell-backend#1.0.0 start /app
> node ./build/server.js
/app/node_modules/#hapi/boom/lib/index.js:126
return internals.initialize(err, options.statusCode ?? 500, options.message);
^
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:931:16)
at Module._compile (internal/modules/cjs/loader.js:979:27)
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 Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (/app/build/routes/getListing.js:14:36)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! buy-and-sell-backend#1.0.0 start: `node ./build/server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the buy-and-sell-backend#1.0.0 start 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/2022-06-10T08_19_42_250Z-debug.log
here is the link of my code
https://github.com/abhijitutkarsh/buy-and-sell-backend/tree/update
I have also tried deleting the node_modules and package.lock.json and then running npm install again
Still it didn't work kindly help

There is a problem when running a node application on ubuntu 18.04

I am trying to run a node site on an azure VM but I get this error when running > SkyCrypt#1.0.0 start
> node init && node index
internal/modules/cjs/loader.js:1109
throw err;
^
SyntaxError: /home/nim1com/SkyCrypt/credentials.json: Unexpected token v in JSON at position 216
at parse (<anonymous>)
at Object.Module._extensions..json (internal/modules/cjs/loader.js:1106:22)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (/home/nim1com/SkyCrypt/init.js:15:21)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! SkyCrypt#1.0.0 start: `node init && node index`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SkyCrypt#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nim1com/.npm/_logs/2021-01-19T09_41_40_472Z-debug.log```
What would be the answer to this problem? I have tried deleting package-lock.json and node_modules
credentials.json
{
"hypixel_api_key": "26ed366f-80ed-4b49-b912-ef46292c6225",
"recaptcha_site_key": "",
"recaptcha_secret_key": "",
"dbUrl": "mongodb+srv://dbStats:*********#cluster0.4kwsp.mongodb.net/test?retryWrites=true&w=majority",
"dbName": vmstats",
"session_secret": "36e47c144b9b9b3e0b9c8bf24c6ac2860c0f76a55b74dcea4007bf355af76789"
}
It seems your /home/nim1com/SkyCrypt/credentials.json file need to be corrected ...
read the error its complaining about the v in "dbName": vmstats", because is not valid json – Lawrence Cherone

TypeError: URL is not a constructor - react-dev-utils/getPublicUrlOrPath.js

Just restarted my machine this morning and woke up to this nice error when running react-scripts start to get my react site running locally.
/blah/blah/node_modules/react-dev-utils/getPublicUrlOrPath.js:52
const validHomepagePathname = new URL(homepage, stubDomain).pathname;
^
TypeError: URL is not a constructor
at getPublicUrlOrPath (/blah/blah/node_modules/react-dev-utils/getPublicUrlOrPath.js:52:35)
at Object.<anonymous> (/blah/blah/node_modules/react-scripts/config/paths.js:26:25)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/blah/blah/node_modules/react-scripts/config/env.js:13:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! blah#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1 npm ERR!
npm ERR! Failed at the blah#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It was working last night but I restarted my machine and it wasn't working in the morning.
Thank you in advance!
False alarm. Just in case anyone else runs into this, you might be using an old version of Node. I have install Node Version Manager (NVM) on my machine and ran the following command:
nvm use v9.5.0
now we're back in business!

Having Problems with Node JS and AWS Elastic Beanstalk

I am getting the flowing errors when I try to build out my app in elasitcbeanstalk
var/log/nodejs/nodejs.log
Error: Cannot find module 'express'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/var/app/current/index.js:1:17)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the app#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
> app#1.0.0 start /var/app/current
> node index.js
internal/modules/cjs/loader.js:638
throw err;
Image of Elasticbeanstak Config Files
My workspace
Try in NodeCommand with : "npm install && npm run start"

npm Cannot find module tobi-cookie; npm unable to install Express; Node.js

I'm trying to install express, but I can't get passed this "tobi-cookie" error.
I installed Connect via npm a few days ago, and it said it was missing tobi-cookie.
I then installed tobi-cookie.
Today I was trying to install Express, and got this back:
[root#dsusim:/home/GUIServer]$ npm info express version
npm http GET http://registry.npmjs.org/express
npm ERR! TypeError: Cannot read property 'url' of undefined
npm ERR! at new Cookie (/usr/lib/node_modules/tobi-cookie/index.js:46:20)
npm ERR! at addCookie (/usr/lib/node_modules/request/main.js:586:26)
npm ERR! at Array.forEach (native)
npm ERR! at ClientRequest.<anonymous> (/usr/lib/node_modules/request/main.js:590:89)
npm ERR! at ClientRequest.g (events.js:175:14)
npm ERR! at ClientRequest.EventEmitter.emit (events.js:95:17)
npm ERR! at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1628:21)
npm ERR! at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:119:23)
npm ERR! at Socket.socketOnData [as ondata] (http.js:1523:20)
npm ERR! at TCP.onread (net.js:510:27)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.8.7-201.fc18.x86_64
npm ERR! command "node" "/bin/npm" "info" "express" "version"
npm ERR! cwd /home/GUIServer
npm ERR! node -v v0.10.4
npm ERR! npm -v 1.2.14
npm ERR! type non_object_property_load
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/GUIServer/npm-debug.log
npm ERR! not ok code 0
I then proceeded to 'npm uninstall' then 'npm rm' tobie-cookie.
Now I'm in big trouble... can't install anything:
[root#localhost:/usr/lib]$ npm info express version
module.js:340
throw err;
^
Error: Cannot find module 'tobi-cookie'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/request/main.js:26:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
.
[root#localhost:/usr/lib]$ npm install tobi-cookie
module.js:340
throw err;
^
Error: Cannot find module 'tobi-cookie'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/request/main.js:26:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
.
[root#localhost:/usr/lib]$ npm install tobi-cookie -g
module.js:340
throw err;
^
Error: Cannot find module 'tobi-cookie'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/request/main.js:26:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
.
[root#localhost:/usr/lib]$ ls /usr/lib/node_modules/
abbrev config-chain fresh lru-cache npmlog read-installed socket.io
ansi connect fstream mime npm-registry-client read-package-json tar
archy connect-master fstream-ignore minimatch once request uid-number
async cookie fstream-npm mkdirp opener retry which
block-stream cookie-signature glob mute-stream osenv rimraf
buffer-crc32 couch-login graceful-fs node-browserify-master pause semver
bytes debug inherits node-gyp promzard send
chmodr delayed-stream ini nopt proto-list session.socket.io
chownr form-data init-package-json npm qs sigmund
combined-stream formidable lockfile npmconf read slide
.
[root#localhost:/home/GUIServer]$ npm update
module.js:340
throw err;
^
Error: Cannot find module 'tobi-cookie'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/lib/node_modules/request/main.js:26:14)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
.
[root#localhost:/home/GUIServer]$ locate tobi-cookie
/usr/lib/node_modules/tobi-cookie
/usr/lib/node_modules/request/node_modules/tobi-cookie
/usr/share/doc/nodejs-tobi-cookie-0.3.2
/usr/share/doc/nodejs-tobi-cookie-0.3.2/History.md
/usr/share/doc/nodejs-tobi-cookie-0.3.2/Readme.md
I used this command npm link express. worked for me..I reinstall the express and I went to directory where my project is located and I performed the npm link epress and worked find.
http://blog.i-evaluation.com/2012/09/17/error-cannot-find-module-express/
Nevermind, solved it with:
git clone git://github.com/isaacs/npm.git
cd npm/scripts
chmod +x install.sh
sudo ./install.sh
from NPM, cannot find 'graceful-fs', no matter what I do
and from NPM can't install appjs. Error: Cannot find module 'graceful-fs'
then did
/bin/npm install express -g
/bin/npm install express

Resources