How to run npm after installing - npm

I want to run npm pakage after installing
c:/>npm i -g pakagename
c:/>pakagename parameters
but I got error 'packagename' is not recognized as an internal or external command,
operable program or batch file.

try : npm install <package-name> -g
it will install that package globally to your system
then check it by checking its version. like
package --version
then do whatever you want
like : https://stackoverflow.com/a/15157360/6747191

To run your installed package with npm you can run it by this command
npm run-script <command> [-- <args>...]
Alias: npm run <command>
According to this documentation: https://docs.npmjs.com/cli/run-script

Related

install packages globally in google cloud platform

I'm trying to install some npm packages globally in google cloud platform each time the shell started.
I added these commands in $HOME/.customize_environment file.
#!/bin/sh
date -u
npm i -g #angular/cli
then, I open the file /var/log/customize_environment to see the log output from $HOME/.customize_environment
I found it executed and the date is displayed (the first line)
but npm couldn't installed with this error npm command not found
npm commands are available after the cloud shell starts, so I guess the file $HOME/.customize_environment is executed before installing node.
I tried to use the full path: /usr/local/nvm/versions/node/v12.14.1/bin/npm i -g #angular/cli, but I got this error
/usr/bin/env: ‘node’: No such file or directory
is there a way to automatically install npm packages globally?
The path env var isn't set or active. Use the full path of NPM location like that
/usr/local/nvm/versions/node/v12.14.1/bin/npm i -g #angular/cli
Be careful. if Cloud Shell update the version of NPM the path will change.
You can also try to add your NPM (without full path) command at the end of the ~/.bashrc file.

npm install runs correctly, but cannot run topojson

If I do:
npm init
npm install --save topojson
I end up with a package.json file and node_modules directory, all looking correct. But if I then do:
topojson
I see:
-bash: topojson: command not found
Why?
The answer to this issue turned out not to be related to npm - npm install topojson no longer installs a command-line tool called topojson. Confusingly, it used to, but the package has changed.
try this step
install globally using -g
1. install nodejs http://nodejs.org/
2. install npm https://npmjs.org/doc/README.html
3. run npm install -g topojson in your command prompt
4. use the command prompt to cd to the geojson file
5. run topojson -o myNewTopojsonFile.json myOldGeojsonFile.json

What is the meaning of using -g during any package installation in NPM?

I know that the meaning of -g is 'global'. But if I type in the following command:
npm install nodemon --save -g
What does the -g mean in the command?
When you install a package globally you can use it in any of your projects, so you don't have to install it in each of your projects separately.
Installing with '-g' option makes the package available all over your system.
in your case 'nodemon' will be available even when you're working in another directory, or drive.

npm can't find in my cmd after I install using nvm

I install npm using nvm by doing 'nvm install 6.11.2'. It said the installation is successful. But when I execute 'npm' in my prompt. It said command not found.
Where does nvm install npm? so that i can update the path for cmd.
C:\Users\john>nvm install 6.11.2
Downloading node.js version 6.11.2 (64-bit)...
Complete
Creating C:\Users\john\AppData\Roaming\nvm\temp
Downloading npm version 3.10.10... Complete
Installing npm v3.10.10...
Installation complete. If you want to use this version, type
nvm use 6.11.2
C:\Users\john> npm
'npm' is not recognized as an internal or external command,
operable program or batch file.
For nvm version 1.1.7
Usage:
nvm on : Enable node.js version management.
nvm off : Disable node.js version management.
Try nvm on .
You need to open a new command prompt to pick up the new environment variables.

'typings' is not recognized as an internal or external command, operable program or batch file

edit: since this question was posted, typings have been deprecated in favor of #types.
Summary
I'm trying to install typescript typings for my web app, but I can't get command prompt to recognize the typings command.
The Problem
typings install throws the following error:
'typings' is not recognized as an internal or external command,
operable program or batch file.
Details
When I run npm i typings -g, the console tells me the module has been installed. But when I look in my global npm directory, there is no typings file.
C:\gitdev\MyWebApp\src\main\webapp\myUI>npm i typings -g
C:\home\123456\AppData\Roaming\npm\typings -> C:\home\123456\AppData\Roaming\npm\node_modules\typings\dist\bin.js
C:\home\123456\AppData\Roaming\npm
`-- typings#2.1.1
More Details
my username has been replaced with 123456 for security purposes. everything else is copied verbatim.
I don't have admin privileges (i'm on a work machine)
where typings also throws an error (INFO: Could not find files for the given pattern(s).
npm -g worked fine for grunt-cli
npm is in my PATH as C:\Users\123456\AppData\Roaming\npm
Try to install typings using npm command : npm install typings --global
after that execute the typings command.
example: typings install dt~hammerjs --save --global
Typings is deprecated in favor of NPM #types -- see README for more information
Link: https://www.npmjs.com/package/typings
Solution:
Install #types/npm
Link: https://www.npmjs.com/package/#types/npm