Whenever I install some packages, runtime.js in regenerator-runtime always removed..
So I always have prepared that files in other folder and pasted when I install some..
It's very vexing thing to me.
It's all same in my all projects where I have this package
who know why this happen??
I don't know why this happens.
just uninstall all node packages and reinstall them then, this problem go away..
Remove yarn.lock (or package.lock)
yarn (npm install)
Related
I'm trying to run an JS Chrome extension from a cloned repository. The problem occurs after I run npm install where some of the dependencies in the package-lock.json file gets deleted and essentially ignored. This causes the project to miss many of the modules necessary for it to run.
I've tried using npm ci but it still has the same problem. I've also tried using yarn and yarn check but to no avail. What is the problem here? Why doesn't npm install all the dependencies in package-lock.json file without having to delete some of them?
We have more than 10 instances of prod servers and each time we update our dependencies, so cleaning and re-installing sounds more controlled, but also a bit slower.
Problem is the devops team complain about the time taken to do a clean (after removing existing node_modules) npm install everytime package.json changes.
We have noticed sometimes our build breaks on prod if we do run update or install on existing node_modules.
Are there any best practices for production deployment?
How can i optimize the process of updating the node_modules safely here?
In newer npm version, there is a feature for locking the version of your dependencies.
There is a file called package-lock.json along with package.json. That lock file
will lock the dependency version while you install it on dev environment. So, when you install it on production from package.json using npm install, it will fetch locked version from package-lock.json file and will install specific version same as dev environment.
That means you don't need to clean node_module folder every time on production. You can just install new added dependency from package.json file and its version will be taken from package-lock.json file.
There is another package manager called "yarn" is there which provide same feature, but if you want to stick to npm, then its now possible with new npm version.
After a couple of months breaking my head on this. I came across this package on NPM:
npm-check-updates.
npm-check-updates allows you to upgrade your package.json dependencies to the latest versions.
All you have to do is run
npm install npm-check-updates --save
ncu -u
npm install
This works very nicely for me.
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}
When I run npm install grunt I get, in my opinion, a heavily polluted project folder. In the folder node_modules there are libs like rimraf, coffescript and others I really don't want to use. Are these required for grunt itself to be able to run or are they only there for my convenience?
I would like some kind of "npm install grunt --minimal" to only install an absolute minimum of what's needed to be able to use grunt. I don't really like my project folder full of stuff that's not really my own code. I've googled the terms i can come up with, like "minimal grunt install", but only found the basic install tutorials.
Create a node_modules directory in a directory above your project's directory and do npm install grunt there. That way the modules are accessible but they aren't in your project's node_modules directory.
Another option is to use npm install -g grunt to install grunt globally.
No, you can not. Grunt is npm package and it has dependencies (this is normal). The fact is this dependencies don't pollute your project folder structure. It is normal to
add node_modules to .gitignore and don't commit it
install every npm package with --save flag (will write package to package.json) or --save-dev flag (will write package to package.json as package needed for development)
commit package.json to repository. Thus, every team member can install all packages via npm install or npm install --production
As Dan said you can install grunt globally with -g flag but this will not solve your problem as every npm package that you install will have it own dependencies (and you'll probably think that it pollutes you folder structure as well)
You know, there are a lot of things that you need for development (or production). While installing apache (or something else) you don't say that is pollutes your file system (but it has own folder and so on).
Things don't pollute file structure if they don't exist in your project repository.
use pnpm
pnpm creates the "deep" node_modules that you want
also saves disk space and network traffic : )
alternative: npm install --legacy-bundling
to produce a deep node_modules
I'm new and I need to use node for off-line use so, I'm trying to understand how the install modules work.
It's the same if I use npm install express or included it in the package.json?
The way a package is installed will be the same whether you manually type npm install express or put it in your package.json and then do npm install. The difference comes when you try to install your Node project elsewhere.
For example, if your code was checked into GitHub and you didn't include a package.json with all of the dependencies listed, then when the project was downloaded you would have to manually re-install all of the dependencies on the command line in order for it to work. But if you had checked in a package.json with the code, then you could run npm install to install all of the dependencies at once, and not have to remember which ones were necessary.
In addition, the package.json allows you to specify an "approximate version" of a dependency to use. This way if a few packages in your project share a dependency and they all specify similar "approximate versions", only one version will be installed and it will be shared between packages. This saves some install time.
Nothing actually. But you don't want to do that again and again. So you might as well put your module dependencies in your package.json