spawn casperjs ENOENT error on AWS elastic beanstalk - node.js

I am trying to run a casper scraper on nodejs using SPOOKY. The scraper works fine when I run it on the localhost but gives the error below when I deploy the project on AWS elastic beanstalk server.
Error: spawn casperjs ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
[nodemon] app crashed - waiting for file changes before starting...
I have tried setting binPath: './node_modules/casperjs/bin/casperjs'" and tried installing Casper globally but was unable to do it. I also added command: /^win/.test(process.platform) ? 'casperjs.cmd' : 'casperjs', to the child but that did not work out either.
I have been searching this for more then a week but was unsuccessful.
Please help me in this issue.

You need to install globally casperjs - npm i -g casperjs
You can read more here

Related

Error spawning ngrok.exe while running an atlassian connect app

I am trying to create a atlassian connect app for Jira, and this is my first attempt at this. I have configured all the dependencies, including Python 2.7 and windows-production-tools required for it. I have generated an app and trying to run it using npm start, when I am facing the following issue:
Watching atlassian-connect.json for changes
App server running at http://IN-8BRM2J3:3000
node:events:505
throw er; // Unhandled 'error' event
^
Error: spawn ./ngrok.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
at process.runNextTicks [as _tickCallback] (node:internal/process/task_queues:65:3)
at node:internal/main/run_main_module:17:47
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
I have already npm install ngrok and successfully configured the auth token using ngrok authtoken my-token.
Seems like node is not able to access the ngrok application. Can someone suggest me how to resolve this issue ?

Issues running a next.js project on server

I am currently trying to run a project (simple test project) of next.js on a Linux server. The project is able to run locally no problem, however every time I run npm run dev or npm run build I get the following error:
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn /nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node EAGAIN
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node',
path: '/nfs/encs/ArchDep/x86_64.EL7/pkg/node-v16.13.0/root/bin/node',
spawnargs: [
'/nfs/www/groups/h/hn_comp353_2/comp353/node_modules/jest-worker/build/workers/processChild.js'
]
}
Any idea on how to resolve this issue?
I see in your spawnargs that it's trying to execute jest, so this failure has something to do with your Jest tests not being able to run on your Linux server. This may be caused by Jest trying to spawn more threads than there are resources available on your server. This is pretty common on heavily virtualized environments where the resources are limited.
Can you try running Jest with either the --runInBand or --maxWorkers=2? If you're running Jest through npm you'll have to add the command in your package.json like this:
{
"scripts": {
"test": "jest --runInBand"
}
}
As a general remark, NodeJS Error: spawn errors are tricky to debug and can be caused by a variety of issues. There's another SO Q&A with a lot of resources on this topic you can consult.

Error: spawn cmd ENOENT in create-react-app

I installed nodejs and after then when I try to run my previous react app by running yarn start it gives me an error something like this.
Even if I make a new app with create-react-app it gives the same error while trying to start.
nodejs apps are working fine so I think the problem is with create-react-app. I don't know how to fix them.
$ react-scripts start
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
And I have no idea what is wrong. Please help me fix this.
Change react-scripts version in package.json to 2.1.8. It works for me.

Ionic error : SPAWN EACCES

This project was created in windows 10 OS , and i changed the OS to Ubuntu ,new projects created from Ubuntu terminal are working.
Error: spawn EACCES
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at Object.exports.spawn (child_process.js:502:9)
at spawn (/usr/local/lib/node_modules/ionic/node_modules/cross-spawn/index.js:17:18)
at spawn (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:124:12)
at ShellCommand.spawn (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-framework/utils/shell.js:113:16)
at Shell.spawn (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/shell.js:127:23)
at IonicAngularServeCLI.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/#ionic/cli-utils/lib/serve.js:392:36)
at Generator.next (<anonymous>)
at fulfilled (/usr/local/lib/node_modules/ionic/node_modules/tslib/tslib.js:104:62)
It's working ! I deleted node_modules folder from project folder and entered in project from terminal
cd name
after that
npm install
Thank you very much for help !

nodemon app.js throws error spawn C:\Program Files\nodejs\node.exe ENOENT

I am getting the below error whenever I run nodemon app.js. I have Node.js 7.4.0 and npm 4.1.2 already installed globally and nodemon 6.7.0 as well. If I run my application using command "node" it works fine but if I use command "nodemon" it throws this error.
I tried to uninstall and re-install nodemon but wtih no difference.
The path for npm has been already added to system variables and "C:\Windows\System32" has been added to both user and system variables.
Any kind of help is highly appreciated.
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn C:\Program Files\nodejs\node.exe ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3

Resources