Node.js can't see ImageMagick on Windows 7 - node.js

I Installed ImageMagick (ImageMagick-6.9.2-3-Q16-x64-static.exe) and add in my js file following:
var easyimg = require('easyimage');
but when I start my node.js app I get this error:
ImageMagick Not Found
EasyImage requires ImageMagick to work. Install it from Link.

In windows, rename file 'magick.exe' to 'convert.exe' will work.

When you install ImageMagick, check the option Install legacy utilities (e.g. convert).

Make sure the ImageMagick directory is in your path. Add it to your system or user PATH environment variable.
Test by opening a new command window and running the following:
cd C:\PATH\TO\NODE_PROJECT\
echo %PATH%
imdisplay.exe
The last step should launch a viewer which is in the imagemagick path.
If you set and verifed the path is correct then you should not get any error when your run:
node app.js
If that fails try removing everything except imagemagick from your path in case your edits have resulted in a corrupt path.
set PATH=C:\PATH\TO\IMAGEMAGICK
C:\PATH\TO\NODE\node.exe app.js

Related

Go moq : running "moq": exec: "moq": executable file not found in $PATH

when trying the example of the moq framework, I get the following exception when I enter "go generate":
example.go:5: running "moq": exec: "moq": executable file not found in $PATH
What should I do? I'm using Kubuntu 16.04
PS: I tried
export PATH=$PATH:/home/[...]/go/src/github.com/matryer/moq
without success
#sprabhakaran got the right answer. I only needed to add the go binary folder to the PATH global variable:
export PATH=$PATH:/home/[...]/go/bin
and if it doesn't work, check that moq was correctly installed.
First, install using the following command:
go install github.com/matryer/moq#latest
Go binary should be added to the global PATH
export PATH=$PATH:$HOME/go/bin
worked for me on MAC

Shopify's 'slate' package not running after installation

I just installed Shopify's 'Slate' package using npm.
Terminal shows that the package was added to '/.npm-packages/lib'.
However, when I attempt to build a new shopify theme using the command 'slate theme newthemename', the command isn't found...
...even though slate clearly was installed.
Curious to figure out what I'm doing wrong, so any help/advice is much appreciated!
Please execute the below command from your terminal.
npm link #shopify/slate
Basically this command creates a symlink to your package folder, it will check for the global (npm) modules first, and will check for the local modules if there is no match.
Hope this helps!
Your installation of slate is successful. However, the slate program (slate/lib/index.js) is not added to environment variable PATH, that's why error command not found is reported.
To fix this issue, a simple method is add slate/lib/index.js to PATH manually. For example, create a symbolic link in /usr/local/bin/ and make it point to slate/lib/index.js:
sudo ln -s /<absolute_path>/#shopify/slate/lib/index.js /usr/local/bin/slate
Please note the first parameter of ln -s must be absolute path. If relative path is used, Mac OS X (I'm on 10.12.6) won't help to translate it.

Sails.js - PATH variable - sails command not recognized

After I npm installed Sails.js on Windows Server 2008, "sails" command is not recognized.
Can someone give me a hint on what values to use in the PATH variable? As I understand it is Node.exe that runs the sails.js file. But if I try tunning "node sails.js" command in cmd, it recognizes it, but can't find some of the dependencies.
On my Windows 7 machine everything installed and is running like a charm.
I ended up writing a batch file and putting it into system32 folder "c:\Windows\System32\sails.bat" with this one line:
node C:\Users\XXXXXXXX\AppData\Roaming\npm\node_modules\sails\bin\sails.js
Now, sails lift works well.
Did you try using the -g (for global) option?
If I use:
npm install -g sails
On either Windows 8.1 or Server 2012R2, I find it is accessible from the path just fine.
Install sails globally
npm install -g sails
If you have right to add Environment variables (Start => Computer=> Properties=>Advance system setting => Advance(Tab)=>Environment Variable(button at the bottom) => User variable for ...(the top one) => find "PATH" => edit ) and add the location of your npm folder (C:\Users\XXXXXX\AppData\Roaming\npm) (this folder can be hidden so enable show hidden folder to locate your path)
open new cmd window and enjoy sails :)
it looks line a sails.cmd file is create in the global npm folder, so if you add this folder C:\Users\XXXXXX\AppData\Roaming\npm to your PATH sails will be a recognized command, and will accept all valid parameters (tried new and lift and both look OK).
In this way all other node packaged that are command line based should work, if they follow this convention to install on Windows (I think this is the case).
I don't have a Windows Server 2008 to test on but it seems it fails to do this process automatically, as it does on Windows 7
If you add a .bat file in system32, remember to add parameters to the bat script. Found that out after trying some of the solutions previously posted here. My example:
C:\Users\Anton\AppData\Roaming\npm\sails %1 %2
Sails is not a directory there, it's a file. Hope this helps someone.
For ubuntu 16.+
Get prefix of node
npm get prefix
look loke this : '/home/ubuntu/node'
now open bash_profile
sudo vim ~/.profile
Add this line if you already have path in this file
export PATH="$PATH:/home/ubuntu/node/bin"
if you node prefix is diff replace with your prefix
export PATH="$PATH:{ your-node-prefix }/bin"
you can add new 'node' commands like 'npm', using batch scripting.
Create a sails.cmd file in your desktop. (new text file -> rename to
'sails.cmd').
Right-click on sails.cmd and select Edit.
Copy and paste this code into your sails.cmd:
#ECHO OFF
SET arguments=%1 %2 %3 %4 %5 %6 %7 %8 %9
node %APPDATA%\npm\node_modules\sails\bin\sails.js %arguments%
Save and copy your sails.cmd into your Node.js installation
directory, for example: C:\Program Files\nodejs
And now everything with sails.js on windows are very simple. Just run this command in your terminal:
sails or sails -v or whatever you want with sails! ;)
Enjoy!
UPDATE!
At this time I highly recommend using the WizofOz solution. It is the most correct way to proceed in a node.js environment.
To help clarify for Windows 8 users. After installing sails globally if receiving errors do this:
Create a sails.txt file
Add this
node C:\Users\XXXXXXX\npm\node_modules\sails\bin\sails.js new
node C:\Users\XXXXXXX\npm\node_modules\sails\bin\sails.js lift
Now re-save it as sails.bat
Add this new file to your C:\Windows\System32
Navigate to the folder you want to hold your new sails app. Scaffold the app with the following command:
sails new
If you don't want a front-end, instead type:
sails new --no-frontend
We can also launch the app using the lift command:
sails lift
This will launch our new app on port 1337
For MAC Users, try this (run the following on your terminal)
export PATH="/Users/username/.npm-packages/bin:$PATH"

Cannot run 'phonegap' command on Win 7

I've just installed phonegap on Windows 7, following the instructions on their website. However, whenever I try to run a simple 'phonegap' command, I get the error:
'phonegap' is not recognized as an internal or external command
I put the phonegap path at the enviroment variables 'PATH' but that didn't do anything at all.
I've also made sure WSH was enabled, but still nothing works.
Am I missing something?
It may just be that the path has not been updated (Have you restarted your machine?)
Alternatively, you can copy the path onto the clipboard, then in a cmd window, do the following:
set path=%path%;<Your path here>
Which will include it in your path for the current session only.
Figured this out...I accidenatlly deleted some nodeJS variables while adding ant and java pathes. Had to reinstall node to realize this.

Node.JS - How to Run Node Command from any path?

I have installed the latest node.js from here . I see the %Path% variables have been set for Node.js. But, When i run node from C:\ , i get a "Node is not an recognized comman". But node command is working fine from "C:\Program Files (x86)\nodejs" path. Can i not run Node commands from C:\ or Say from an other path if i set the Env variables right? Please help. I am running a Win7 X64.
Thank You,
Faraaz
I had the exact same problem, but in my PATH variable I had: C:\Program Files\nodejs\.
After changing it to C:\Program Files\nodejs I could access it from anywhere.
What happens if you run node --version? I have never tried node.js from windows but if that doesn't work there is something wrong with your paths.
What do you get when you run echo %PATH%?
You should check if the path C:\Program Files (x86)\nodejs is present in your %PATH. If not, add it via the system properties (persistent change). In any case, restart your command prompt, it'll reload the %PATH variable. If you're lucky, it should work now :)
Most likely it happens because there is no Node path in your PATH environment variable.
I see two ways to solve this
Just add Node path into the end of PATH.
Reinstall Node as administrator
run 7-zip (or some file manager) with administrator privileges >>
browse to node-installer.msi >> open it, install node >> enjoy
My Sublime was working with Nodejs fine. I could press Alt-R and see the output from Node in Sublime. Then at some point I upgraded Sublime. I now have version 2.02 build 2221
And at some later point I tried Alt-R and got this infamous message
'node' is not recognized as an internal or external command
But it had worked, so what changed?
The steps I took to fix it were to install git bash and then
$ git clone https://github.com/tanepiper/SublimeText-Nodejs.git
$ cd SublimeText-Nodejs/
$ git checkout 095ba03344
Back in Sublime I clicked Preferences > Browse Packages. This opened up Windows Explorer with the folder:
C:\Users\me\AppData\Roaming\Sublime Text 2\Packages
I replaced the contents of the Nodejs folder with the git version. Re-started Sublime and then Alt-R sprang back into life.
Other things that turned out to be irrelevant were changing the file Nodejs.sublime-settings and tampering with system environment variables. The only thing that worked was 095ba03344 as described here
https://github.com/tanepiper/SublimeText-Nodejs/pull/39

Resources