run casperjs from node app folder - node.js

Ok, let's make it simple :
I migrated my working node.js app to a new server today. The app spawns casperjs processes to do stuff.
Problem :
It doesn't run anymore
Why?
output casperjs --version from any folder but the one where my node app is installed :
root#xxxxx:/var# casperjs --version
1.1.0-beta3
now from the folder where my node app is installed :
root#xxxxx:/var/nodeapp# casperjs --version
Error: Cannot find module 'sys'
phantomjs://bootstrap.js:289
phantomjs://bootstrap.js:254 in require
/var/nodeapp/node_modules/system/engines/node/system.js:8
/var/nodeapp/node_modules/system/engines/node/system.js:45
1.1.0-beta3
Isn't that weird? :D Thanks for any insights
Edit : Tried uninstalling casper, then reinstalling from npm (I used github before). Same error.

-DEV was the previous version (see https://github.com/n1k0/casperjs/commit/9f510ed68010b3fadc8842115a12d2712213779d#diff-b9cfc7f2cdf78a7f4b91a753d10865a2 ), up to about 4 months ago. So 1.1-beta2 should give you that.
You could also try getting the latest git version; you can see a list of changes since 1.1.0-beta3 here (I don't spot your problem though): https://github.com/n1k0/casperjs/compare/1.1-beta3...master
By the way, are you running the same PhantomJS version on each of the working and non-working server? (Actually, what I would do next is upgrade your other server to first CasperJS 1.1-beta3, then the latest PhantomJS, and see if it breaks. If not, then it is not the software version but something else about the environment of the new server.)

Related

I am making a website using django and tailwind css. But in Cpanel I am getting this command error of Node Js path. Any suggestions what I can do?

CommandError:
It looks like node.js and/or npm is not installed or cannot be found.
Visit https://nodejs.org to download and install node.js for your system.
If you have npm installed and still getting this error message, set NPM_BIN_PATH variable in settings.py to match path of NPM executable in your system.
Example:
NPM_BIN_PATH = "/usr/local/bin/npm"
For windows user, add
NPM_BIN_PATH = "C:/Program Files/nodejs/npm.cmd"
to settings.py
In order to find out if Node is installed on your hosting environment, you can use:
node -v
If this returns a version, then it is an indicator that there is NodeJS installed by default. And to find out the full path to the node binary, use:
whereis node
OR
which node
Once you got the full path, define it inside the settings.py of your Django.
However, if you still experience difficulties with that, I would strongly recommend finding a managed NodeJS web hosting provider that will natively have NodeJS and their support can help with such questions.

Is there a way to RUN multiple versions of Node.js simultaneously on Windows?

So, to be clear, I'm not asking about the possibility of INSTALLING multiple versions of Node, or the capability of switching between multiple versions with something like nvm.
(The original nvm package for Mac/Linux has an "exec" command that lets you run a command under a particular version of node. I think this would be a solution--but the nvm for Windows package doesn't have that "exec" command.)
Context:
I have an Azure function app API that must run under Node 14.0.0 (a requirement of Azure Function Core Tools version ~3, which itself is a customer requirement).
I also have a basic React app (using Parcel bundler) that runs under Node 11.14.0. I can't update the Node version to 14.0.0 because of an error ("Cannot locate the bindings file...").
For testing purposes, I need to run both simultaneously, so I can hit my API with my React app.
I have tried starting my API under Node 14.0.0, then using nvm to switch to 11.14.0 to run the React app, but it causes the API to fail with an "unsupported Node version" error. I haven't tried the converse approach because this error (along with the UAC prompt) tells me that the Node version in use is global.
Does anyone have any ideas of how to run two versions of Node on Windows? Or can anyone suggest another practical work-around?
Thanks in advance.

Node error when I run npm with laravel breeze

I have this error when I run npm run dev or npm run watch and I didn't find what is the mess. It's happens in a all fresh Laravel 8 app.
It looks like happen when I use the developement command
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: [(...variantsValue),(...extensions)].flat is not a function
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:219:73
at baseMergeDeep (/var/www/html/smart_recipe/node_modules/lodash/_baseMergeDeep.js:42:7)
at /var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:27:7
at /var/www/html/smart_recipe/node_modules/lodash/_createBaseFor.js:17:11
at baseMerge (/var/www/html/smart_recipe/node_modules/lodash/_baseMerge.js:24:3)
at /var/www/html/smart_recipe/node_modules/lodash/mergeWith.js:36:3
at /var/www/html/smart_recipe/node_modules/lodash/_createAssigner.js:30:9
at apply (/var/www/html/smart_recipe/node_modules/lodash/_apply.js:15:25)
at /var/www/html/smart_recipe/node_modules/lodash/_overRest.js:32:12
at mergeVariantExtensions (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:218:33)
at resolveVariants (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:235:10)
at resolveConfig (/var/www/html/smart_recipe/node_modules/tailwindcss/lib/util/resolveConfig.js:271:15)
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/index.js:77:37
at /var/www/html/smart_recipe/node_modules/tailwindcss/lib/processTailwindFeatures.js:52:20
at LazyResult.run (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:288:14)
at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:212:26)
at LazyResult.asyncTick (/var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:225:14)
at /var/www/html/smart_recipe/node_modules/postcss/lib/lazy-result.js:217:17
at runLoaders (/var/www/html/smart_recipe/node_modules/webpack/lib/NormalModule.js:316:20)
at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/var/www/html/smart_recipe/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Promise.resolve.then.then.catch (/var/www/html/smart_recipe/node_modules/postcss-loader/src/index.js:208:9)
# ./resources/css/app.css
I came across same issue and spent 5 hours on finding solution but could not.
After searching alot, I came across this
"Tailwind CSS v2.0 no longer supports Node.js 8 or 10. To build your CSS you'll need to ensure you are running Node.js 12.13.0 or higher in both your local and CI environments."
at https://tailwindcss.com/docs/upgrading-to-v2
So I realized that issue was in my Node version which was 10.x so
I uninstalled Node from my windows machine and downloaded LTS version (14.x).
So consider updating your Node version, it will solve the issue as it did work for me.
There is possibility that old node versions don't have that flat function that Tailwind CSS 2 has implemented and that's throwing error.
I Had the exact same issue after installing Breeze... Unfortunately the npm error message gives no clue of what is really going on !
Thanks to #DaniyalGondal I found out that my node version was raising the error because of tailwind V2 requirements (https://tailwindcss.com/docs/upgrading-to-v2) that comes with Breeze... So I did upgrade my node version using : sudo n latest under ubuntu20
Don't forget to restart your terminal after upgrading and check that your node is correctly upgraded using : node --version
If the node version is above 12.13.0, now npm run watch or npm run dev should work fine !

React start up problem with new react app windows [solved]

Hello i am not really sure how to explain my problem or how to ask for help.
But am going to try it anyway lately when i create a react app it installs like normal.
But from the moment i use npm start i get this error (npm start error terminal).
Which says it has nothing wrong with node js/npm so i suspected it was something about the react app dependency that was wrong. When i downgrade to a older version of react scripts it works but the newest version 16.13.1 doesn't work even tho i use this version of react on my windows laptop. In case it helps to solve my issue here is the error log that npm generates (error log npm) i hope this helps to solve my issue
I have found the solution for my problem by setting the path value for system32.
You can do this by the following steps
Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart your System.
After i have done these steps it seems to work

Unable to install nodejs on my computer

I am using windows and when I took reference to download node js from here. When I write this line
C:> cinst nodejs.install -Version 0.6.10
in CMD it gives an error
C:>cinst nodejs.install -Version 0.6.10
'cinst' is not recognized as an internal or external command,
operable program or batch file.
I don't know how to install node js.I also have a question that if I install node js version say v0.10.26 will the programs made with previous versions(say 0.9) will work on 0.10
That error means that your cmd session can't find cinst. To use cinst, you have to install the package manager from http://chocolatey.org/
If you just want to get Node.js running though, there's a Windows installer at http://nodejs.org/download/ or you can just hit the big green Install button at http://nodejs.org/
Summarizing comments:
All of the versions are maintained and available under http://nodejs.org/dist/, 0.6.10 can be found at: http://nodejs.org/dist/v0.6.10/ and you can get the Windows installer by downloading the .msi file.
As for whether there might be breaking changes from version to version, most code moves forward just fine, but testing is always a good idea. Some packages will specify a specific version in their package.json file, but most will just request a version greater than a certain point in the engines element like:
{ "engines" : { "node" : ">=0.6.10" } }

Resources