install npm module in my project - windows

I have node.js project on drive "F".
for example F:\development\WebStormProjects\test-app\
so, how i can install nmp module (npm install twitter-bootstrap-node) in that project folder?
my os is windows.
Thank's in advance.

You can either add the module as dependency to your package.json or install it manually. In any case, typing above command in the command line while being in your project directory should have the desired effect.
If you've added a module as dependency then a simple npm install from the project root should suffice.
EDIT: Global installation of modules is not the default, if you were worried about this. You have to actively trigger it with npm install -g $MODULE_NAME

Related

Yarn install trigger all scripts in my package.json, it is normal?

The documentation doesn't mention this specifity:
yarn install is used to install all dependencies for a project. This
is most commonly used when you have just checked out code for a
project, or when another developer on the project has added a new
dependency that you need to pick up.
Yarn install : Install all the dependencies listed within package.json in the local node_modules folder.

npm choose global install directory

I want to install npm dependencies from a package.json in the current directory, but I want to install them to a different directory.
Can I make this setting (install directory of node_modules) project specific, so as to not interfere with my other projects?
You can try --prefix.
npm install --prefix new/path/node_modules
https://docs.npmjs.com/misc/config#prefix
NOTE: Important, that there is a node_modules folder

Node.js/Windows error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm'

I have Windows 7 32-bit. I installed the latest Node.js 32 bit.
When I try to run the command npm install jquery, I receive the error:
Error: ENOENT, stat 'C:\Users\RT\AppData\Roaming\npm
How does one resolve it?
Manually creating a folder named 'npm' in the displayed path fixed the problem.
More information can be found on Troubleshooting page
I ran into the same problem while installing a package via npm.
After creating the npm folder manually in C:\Users\UserName\AppData\Roaming\ that particular error was gone, but it gave similar multiple errors as it tried to create additional directories in the npm folder and failed. The issue was resolved after running the command prompt as an administrator.
This can also be fixed by installing a node package manually.
npm install npm -g
The process of doing that will setup all the required directories.
I recommend setting an alternative location for your npm modules.
npm config set prefix C:\Dev\npm-repository\npm --global
npm config set cache C:\Dev\npm-repository\npm-cache --global
Of course you can set the location to wherever best suits.
This has worked well for me and gets around any permissions issues that you may encounter.
You can go to the Start Menu and search the Node.js icon and open the shell and then install anything with
install <packagename> -g
Install a stable version instead of the latest one, I have downgrade my version to node-v0.10.29-x86.msi from 'node-v0.10.33-x86.msi' and it is working well for me!
http://blog.nodejs.org/2014/06/16/node-v0-10-29-stable/
I needed a package from github that was written in typscript. I did a git pull of the most recent version from the master branch into the root of my main project. I then went into the directory and did an npm install so that the gulp commands would work that generates ES5 modules. Anyway, to make the long story short, my build process was trying to build files from this new folder so I had to move it out of my root. This was causing these same errors.

Polymer installation on windows

Has anyone installed Polymer on windows? I am new to using GIT and it says you need Bower and Node and some other things to get it to work.
We are working on a simple ZIP file for people to download and get started, but we haven't finished that yet.
Until we get that ZIP done, you will want to get started by installing Bower. Bower helps you manage component installations. You can worry about GIT later.
Install Bower:
Install nodejs
execute this command:
npm install -g bower
Make a project, acquire some Polymer elements:
make a project folder
inside project folder, execute this command:
bower install Polymer/polymer-ui-elements
That will produce a number of components in your project folder to help you get started. Please refer to http://polymer-project.org for more information.
Step 1:- install node.js
Step 2:- install Git
set the Git location Path (system's environmental variable)
like:-- D:\Program Files\Git\cmd
Step 3:- install bower using npm install -g bower command check the location of npm global binaries by using command (npm config get prefix).
copy the Path and set the bower location Path (system's environmental variable)
like--> C:\Users\USER_PROFILE\AppData\Roaming\npm
the whole Path will look like..(node to Polymer)
D:\Program Files\nodejs\;D:\Program Files\Git\cmd;C:\Users\USER_PROFILE\AppData\Roaming\npm
Step 4:- using command prompt go to project folder or create a project then type
bower install polymer
inside project
folder.

Grunt installed but not working - "Command not found" on Mavericks

I'm trying to use grunt with sass and have been following these guides:
http://gruntjs.com/getting-started
http://benfrain.com/lightning-fast-sass-compiling-with-libsass-node-sass-and-grunt-sass/
http://www.hongkiat.com/blog/grunt-command-not-found/
I've:
Intsalled node.js
Installed the command-line version of grunt: sudo npm install -g grunt -cli
Added the path from the grunt installer to my bash profile: export PATH=/usr/local/lib/node_modules/grunt/bin:$PATH
Made the profile an executable: source ~/.bash_profile
Setup package.json and Gruntfile.js files in my project root
Installed grunt into the project: cd /path/to/project/root/ and sudo npm install
But when I try to run grunt I see: command not found
It's the same if I run: grunt --version
I wasn't sure if the bash path needs /bin on the end as per the blog posted above but have tried it both ways:
/usr/local/lib/node_modules/grunt/ and /usr/local/lib/node_modules/grunt/bin/
I've also run the grunt installer several times but didn't see any errors so am positive it's installed - can anyone see what I'm doing wrong? I'm running OSX mavericks incase this is the issue.
Any pointers in the right direction would be much appreciated.
Cheers
You have a typo in your command. The package is named grunt-cli without the space.
Update the command to:
sudo npm install -g grunt-cli
And all should work as expected.
Hope this solution also might be helpful to someone. In my case it was a bit trickier.
In command line type the following command
npm install grunt-cli -g
This will show you the location where the grun client is installed:
Copy this location and paste it into a file browser. Was this in my case.
C:\Users\zkhaymed\AppData\Roaming\npm\node_modules\grunt-cli\bin
This will open you the location of a grunt file.
Click on the address line of the location and copy it as a text clicking on the right mouse button.
Now go to the Advanced properties of the system at control panel, and paste this address into a System variables and user variables without deleting the other variables.
I was having a very similar issue, hopefully this helps.
1) You want to check where node and npm are actually installed. If you used a package manager, such as Homebrew or MacPorts, there may be an issue with the location. Just use the downloadable installer from node.js website. Make sure to use the current version, not the long term support (LTS). The installer will install node and npm in /usr/local/bin, which should already be in your PATH. If you already have node/npm installed you can use which node and which npm to see where they are currently located. You should see /usr/local/bin/node and /usr/local/bin/npm, respectively. You will need to update npm after installing with npm update -g npm. This may require sudo.
2) Once node and npm are correctly installed/updated go to the project's root directory (where you have the Gruntfile.js and package.json) and install Grunt using npm install grunt --save-dev. Remember that Grunt After doing so you should see a new folder called node_modules.
3) Make sure to do the previous step before installing the CLI. You can use Grunt's getting started documentation to help guide you the rest of the way. Just be aware that the instructions for installing Grunt are further down the page than installing the CLI, which makes it somewhat confusing. When Grunt and Grunt-CLI are installed run npm install and run grunt in the command line to execute your Gruntfile.js.
You should now be able to see the versions installed. Note that if you are outside of a project's root directory you will not see a version of Grunt but you will see the Grunt-CLI version. This is because the CLI was installed globally (used from any directory/subdirectory) but Grunt is installed on a per-project basis.
Hopefully this helps!
I just ran into this scenario as well. The following worked for me:
Try deleting C:/Users/{username}/AppData/Roaming/npm and C:/Users/{username}/AppData/Roaming/npm-cache (if it exists) and reinstalling global npm modules.
Source: https://github.com/nodejs/node/issues/29287
I had to add this to the PATH (on a Mac after brew install node ):
export NPM_HOME=/usr/local/Cellar/node/6.3.1/libexec/npm
The npm install was not effective, no matter what args I passed to it.

Resources