https://github.com/BlackrockDigital/startbootstrap-freelancer
When I download this template, I have ready made package.json & gulpfile.js.
How can I install all devDependencies? Should I use defaul construction for every plugin:
npm i [plugin_name] [another_plugin_name] --save-dev
or another quick command?
Shoud I begin work with
gulp init
?
Running
npm install or npm i
will install both dependencies and dev dependencies
Related
I'm using npm package manager to install dependencies in my application. I've listed all the required dependencies in package.json file. I've just added a new dependency for ng-infinite-scroll and I want this to be a js version, but when I ran the npm it installed the cofeescript version of it. How do I specify in my package.json to pick js version of it....any ideas???
I just ran:
npm install --save ng-infinite-scroll#1.3.0
and it worked!. True it did bring in "inifinite-scroll.coffee", but it also brought in the javascript file.
JS File Location
ng-infinite-scroll \ build \ ng-inifinite-scroll.js
package.json
"ng-infinite-scroll": "1.3.0"
I just switched to gulp task runner to automate my workflow, but there is this problem whenever i want to start a new project i have to install all packages required in gulpfile.js using the following command:
npm install --save-dev {package name}
Imagine there are 20 of them, it's a bit boring. How can simplify this?
You can add multiple package names to npm install:
npm install --save-dev package1 package2 package3
npm will install and save the specified packages in your package.json.
Personally I use mostly the same gulp plugins for all of my projects. I copy the devDependencies bit from the package.json of one of my previous projects into my newly created package.json, then I run npm i which installs all dependencies listed in package.json. It's a huge timesaver, especially since I usually copy my gulpfile.js as well.
Note: don't forget to run npm outdated if it's been a while since your previous project started, to check if any of the dependencies have been updated in the meantime.
You can also use brace expansion for installing many similarly named packages:
npm i -D babel-{core,preset-es2015,preset-react}
What happens when you do npm install in a dev environment on a project that has both a package.json and a npm-shrinkwrap.json file?
Will it ignore the shrinkwrap and use package.json for everything or just for the dev dependencies?
Any files added to the production dependencies in package.json will be ignored if they are not in the npm-shrinkwrap.json. Vis-à-vis: running npm install with foo-package added to the production dependency list will not install foo-package.
Not so for devDependancies.
Running npm install with foo-package added to the devDependency list will install foo-package even if it is not found in the npm-shrinkwrap.json file.
Fun.
Node: v4.2.4
NPM: 2.14.12
I created a package.json and added the needed dependencies (grunt, bower, jasmine etc)
when I run
npm install
it correctly installs all the modules in
$pwd/node_modules/*
however when I try to USE those modules:
bower init; grunt init
i get
sh.exe: (bower / grunt / w.e) Command not found
I can solve this by using
npm install -g (package name)
but my understanding is the "-g" makes the install global? (is that correct?)
I want to be able to use the packages i installed locally...is this possible?
You can use npm run-scripts to create a command which will run the local copies of bower and grunt that you have installed.
In package.json, add a key like this:
"scripts": {
"init": "bower init; grunt init"
}
Then run the command npm run init.
I'm trying to install packages using Bower.
Without a .bowerrc file, it works. For example, bower install angular#1.0.6 will install nicely inside ./bower_components.
If there is a .bowerrc with { 'directory' : 'public/javascripts/vendor' }, bower install angular#1.0.6 will not work. Actually, the output of that command is nothing. It simply prints a blank line, then the next line is my terminal prompt. The package is not installed anywhere.
However, if there is an empty .bowerrc file, it will install the package inside ./bower_components.
Why is it not installing the packages and how can I fix it? (so they will install)
Additional info:
No bower command works. bower will fail similarly. bower help too. In fact, bower anything will too.
I just solved this. I uninstalled and reinstalled bower, and now it works. :S
sudo npm rm -g bower
sudo npm install bower -g
Now everything works fine!
The solution here is simple :
Install Bower in your public directory ( Not your app/node master directory )
For example, mynodeapp/public - npm install bower
Then, set up bower from this directory : bower init
Create your .bowercc file, and add to it :
{
"directory" : "vendor"
}
//Where vendor is your custom fldr
Thats it. Now whenever you run a bower install command from within the public directory, it will either create or save to that "vendor" directory.
Everyone seems to have trouble because they are installing Bower outside their public folder.
Try to run with -f flag (force)
bower -f install
I think that you should be reinstall the bower
npm rm -g bower
npm install bower -g