I use a lot of private node packages (stored on my personal github repositories) in my projects:
"devDependencies": {
...
"my-package": "github:username/my-package#master"
...
}
my issues is that, when updating a project or when running npm install
, the process takes so long (~ 2 mins), while it's stuck doing something like:
reify:my-package: timing reify:loadBundles Completed in 0ms
Is there anything I can do to speed up the processes when using private repos?
Thanks
Summary. DO NOT USE YOUR OS PACKAGE MANAGER TO INSTALL NODE. JS OR NPM - You will get very bad results as it seems no OS is keeping these packages (not even close to) current. If you find that npm is running slow and it isn't your computer or internet, it is most likely because of a severely outdated version.
The first application, lets refer to it as “EE”, runs in under 5 mins, while the other is taking over 10 mins to complete. It appears the problem is related to the npm install task.
NPM installs devDependencies within the package. json file. The 'npm install' command should add all the dependencies and devDependencies automatically during installation. If you need to add specific devDependencies to your project, you can use this command- 'npm install --save-dev'.
A private GitHub repository can be installed using the git+ssh as protocol: Note: A GitHub package must have a meaningful package.json file to be installed as a package. The npm install command also provides many other features. For example, range can used to install a package with a given range for the version:
The npm command will try to install the package using git clone. The npm command can also install the package from different GitHub repository states using a commit hash value, which can be used to install the package with a commit id: 1 npm install use_name/node_project#commit
And, with Windows, comes virus scanners, and virus scanning can make NPM install very slow! Adding an exemption or disabling virus scanning during install can greatly speed it up, but potentially this is undesirable given the possibility of malicious NPM packages Problem: NPM does not perform well if you do not keep it up to date.
You could use Yarn as an alternative to install npm packages, it does provide faster installs. Sorry, something went wrong. Strange behavior in corporate network it's taking hours with HTTP:/registry but inside my home network it's taking hardly 5 minutes
This isn't a problem with Private repositories or GitHub, NPM itself has been very slow recently. You might want to go with a faster alternative like yarn
, It's much faster and can save a ton of time.
To install Yarn you just have to run npm install yarn -g
. That will install yarn globally.
This cheat sheet of Yarn alternatives to NPM commands can help - https://shift.infinite.red/npm-vs-yarn-cheat-sheet-8755b092e5cc
Hope it helped :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With