So I'm following:
http://giantflyingsaucer.com/blog/?p=894
and installing node.js.
I got up to the part with sudo make install.
It works, then it says to create a js file.
What I don't understand is where I put the sayhello.js?
Node.js looks at least for the programmer more like a interpreter. Thus, you can place your sayhello.js whereever you want and run it by executing node sayhello.js.
However, you might consider using external modules. Then you must check that they are set by full path or the relative path can be resolved from the location you execute node in.
Related
I have a yarn-workspace with different packages installed different versions of the same cli tool.
assume it is called the-cli
then whe I do npx the-cli, what option can I add to make npx print out the path for executed the-cli, so I know if it is picking up the right version. kind of like which the-cli
so I've been trying to run an SMS script after the user submits a form.
If I use
node send-sms.js
locally on my machine, it works.
However, if I try to use
$sendSmsPath = "send-sms.js";
exec('/public_html/node_modules/node '.$sendSmsPath);
Nothing happens. No error, nothing. I tried using a relative path, as well as an absolute one. My folder scheme is as follows: public > other_folder > php > php_file.php AND public > node_modules
Any ideas are welcome, thanks
You are using the wrong path to Node.js. Try this:
<?php
$sendSmsPath = "send-sms.js";
exec('/c/Program Files/nodejs/node '.$sendSmsPath);
node_modules is for the dependencies of your script, not the actual Node.js executable.
If you'd like to run your script on another machine make sure it has Node.js installed globally and you know the path of the executable (can be found with which node)
I'm trying trying to use a node module inside my Azure Functions project. I've tried following these instructions several times but still can't use the module I'm trying to bring in.
After bringing in my package.json and running npm install, I can see the node_modules folder (actual modules are located in node_modules/.staging). Upon restarting the function and trying to run it, I get Error: Cannot find module '_____'.
I'm following the instructions correctly. Any suggestions on how to get the modules to work?
You did everything correctly, after npm install, please wait for some time. Modules being in ./staging folder means the installation is still in progress.
You will see added packages prompt in console after the installation is finished.
Update--Avoid long time waiting for module install.
As #brettsam mentioned in comment, with azure-functions-pack tool(also a module), we can place all the modules in a single file, no need to install online and wait. You can search for your function name to find your function scripts if you want to edit after publication.
I'm trying to simply create a React Native project via Webstorm but I get this error upon trying to do so which's resulting in myself not being able to start a project.
Whenever I do choose a Node interpreter it gives me an error that says Unspecified react-native cli package at the same spot that says Please specify node.js interpreter correctly.
I've been starting React Native projects like this since the beginning but this time I get this error out of no where, I don't know where it came from. How can I fix this?
Opens up your terminal, and use the which command to find our your NodeJS interpreter
$ which node
/Users/felixfong/.nvm/versions/node/v8.0.0/bin/node
And copy that result, and update your Node interpreter field inside yoru WebStorm
Hopes this help
I'm trying to get node.js to run a sample script I've created. I'm using Windows. mysamplescript.js is in the same folder as the node.js executable. When I type in
node mysamplescript.js
I get ... returned on the next line. The docs for node aren't exactly stellar. Am I missing something?