cannot run npm global modules on linux - linux

Checkout the screenshot: Linux terminal
I have installed the global modules using npm but I am not able to use it. For example I run the command "stylus -v" and the terminal replies me with nothing. I am not able to understand why this problem might be happening as I am new to linux.

Related

Are there any tools to run scripts of npm package.json both on Linux and windows?

...I wrote some scripts for the package.json of a node project. when I use some syntax, for example, BUILD_PATH= in the script I am only able to run this npm script whit the WLS command line (Linux) but for using with bash in windows it throws an error. I'm wondering are there any tools to run such scripts like this both in windows and Linux?
example: from my package.json
"scripts":
{"build": "BUILD_PATH=../server/public react-scripts build"}
when I execute that with the Linux command line (WSL) it goes well.
but with windows, it throws an error.
I know what windows equivalent for this command.
but I wondering one tool or package to do this automatically.
I have found the npm default shell isn't git, although I run the npm command in bash.
to fix it, It needs to run the following command to replace bash as a default shell.
npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
I hope it helps and works for other people that might be faced with this issue.

npm run doesn't work after install git for windows

I installed git for windows. Since then I can't run any electron project. Before the git installation it worked perfectly.
Now I have this error in the terminal on Visual Studio Code. How do I fix this?
Lifecycle scripts included in sample_gym_app:
start
electron .
PS E:\projects\electron test\gymapp> npm run
Scripts available in sample_gym_app via `npm run-script`:
pack
build --dir
I suspect you may have left out one of your npm parameters.
Try npm run start
The npm run command expects to receive the name of a script to run, oftentimes start.
If this answer is correct and works for you, consider doing some further reading on npm commands. See https://www.sitepoint.com/beginners-guide-node-package-manager/ for example.

What is the 'npm' command and how can I use it?

What is npm?
Whenever I browse through some project they ask me to run npm command, something like this
npm install -g node-windows
I went through some blog posts to learn about npm and I installed Node.js. However, when I run the above code in Node.js, I get the following errors:
When I browsed further, I came to know that the windows user can run the command from the cmd prompt window, but when I do that I get some output like this:
Which just generate a text file nothing else.
My questions:
How can I get started with the AngularJS2?
How can I run an npm command?
Do I require a command prompt to run the npm command (in Windows), or I can just use Node.js?
When I use the command npm install in my command prompt, I get the following output:
How to get started with the angularJS2
Follow this link and set up the project by following instructions
How to run a npm command
npm stands for Node Package Manager, and therefore you need Node.js installed before you can run npm commands.
Follow this and install the latest version. And restart the command prompt.
Do I require a command prompt to run npm commands (in Windows), or can I just use Node.js?
Yes, you need to run npm commands from the command line (in Windows).
E.g., npm install
You get the warning because there is no package.json file present where you are running the command.
ENOENT stands for Error NO ENTrey
Navigate to the project folder using the following command and then run npm install
cd <projectpath>
The AngularJS 2 website has everything you need to be covered. Their quickstart guide alongside with the quickseed zip file helps a lot.
But, in case you missed some points:
yes, you will need npm/NodeJS. So, download the latest distribution and have a clean installation of it.
you can execute the npm command with its parameters from within the Windows cmd.
the quickseed ZIP file contains all the files you need to see a live and quick example running locally. Unzip it on your workplace and navigate to it using the windows cmd. When inside the root folder of the unzipped package, execute npm install and right after it npm start.
Take the learning path. Step by step, all your questions will be answered.
You need to use an admin prompt for global installation (-g).

npm.cmd closes instantly after few seconds

I'm learning nodeJs. I managed to run nodejs commands on cmd and it works fine. Now I want to install express framework and for that in the tutorial I'm following it asks to type sudo install -g express on npm command prompt. So I typed npm in my windows search, and clicked on it. Right after few seconds less than 3 it closes straight away.
I found that npm.cmd exist in nodejs directory where node.exe found. What could be the problem here. If I were to type the above mentioned command in windows cmd, it says sudo is unrecognized program.SO must I use npm cmd?
After running cmd.exe , I guess you would have node installed but still run node -v , it should respond with the version meaning it's working.
Now if you want to explicitly install express.js you just have to run on, the command prompt itself,
npm install express -g.
Anyways you can follow this link from their official website. Hope it helps. Also sudo is a program for Unix like operating systems, just in case you needed it.

Globally installed node-dev causes error "command not found"

So that I don't have to keep restarting node.js during development I'm trying to use node-dev. Unfortunately, when I try to run node-dev from terminal I receive the error:
$ node-dev server.js
-bash: node-dev: command not found
I have globally installed node-dev via the npm install node-dev -g command. The output from this command is:
npm http GET https://registry.npmjs.org/node-dev
npm http 304 https://registry.npmjs.org/node-dev
npm http GET https://registry.npmjs.org/growl
npm http 304 https://registry.npmjs.org/growl
/usr/local/share/npm/bin/node-dev -> /usr/local/share/npm/lib/node_modules/node-dev/node-dev
node-dev#0.2.9 /usr/local/share/npm/lib/node_modules/node-dev
└── growl#1.6.1
To be sure node-dev is installed globally I've run npm ls -g which returns:
/usr/local/share/npm/lib
└─┬ node-dev#0.2.9
└── growl#1.6.1
Some other posts have indicated that my globally installed npm modules should be in the /usr/local/lib/node_modules folder instead of /usr/local/share/npm/lib/. I can't tell if this is for older versions of npm or something that actually matters.
I'm new to both Mac OS X and Node development so it wouldn't surprise me that I was overlooking something trivial. What haven't I done which is causing me to get a "command not found" error when trying to utilize node-dev? Is there some sort of $PATH environment issue I'm overlooking?
One note I don't have Growl installed but the node-dev documentation indicated it was optional.
I think this could be your issue, and here's a walk-through to fixing it. It's specifically for WebStorm & Mocha, but seems like it could be related. I think you may need to setup an alias.
env: node: No such file or directory
Reason for this is that when running GUI applications under MacOSX,
the environment variables are not the same as those when you run a
from a terminal. In particular, node for instance is not on the path.
To overcome this issue, you can either launch WebStorm from the
terminal (yuck!) or solve it. Fortunately this isn’t as hard as it
once was. Here’s a Tip on our forum for RubyMine but it applies to all
IDE’s including WebStorm. In essence, its creating an
environment.plist file inside ~/.MacOSX which contains your full path.
Mine is here if you want to download it. Make sure you reboot your
machine after doing this step.
Setting up an alias
Everything should be working now, but instead of
having to type this in each time, lets set up an alias for it in
WebStorm. Click on Preferences (CMD+, under MacOSX) and type in
Command to get to the command line tools. Click on the + button to
create a new entry and confirm the dialog box to create a new custom
framework.

Resources