We have an Angular 6 project which contains approximately 660 MB of packages in the node_modules folder. Since the project's inception, upon building the project we would remove the entire node_modules folder and then perform an npm install to re-download and install all of the packages found in package.json.
However, the build times have increased to 15 - 20 minutes. If we comment out the command to remove that folder the build time is between 3 - 4 minutes. What are we gaining to always have a brand new download of the defined packages?
Related
I have two workspaces in my mono repo workspace-a and workspace-b. One depends on jest version 26 the other on 29. When I do yarn install it will install jest-26 in the root node_modules and the other one in node_modules of workspace-b.
It will then symlink the jest script in workspace-b/.bin/jest to the older jest version in the root node_modules.
So when I run yarn workspace workspace-b jest it will invoke jest-26 even though the dependency is states as 29 and it actually installed the correct version in the corresponding node_modules directory.
To me this behavior seems odd.
I could fix it and manually link it to the right version but I wonder if I did anything wrong in the setup or if this is the default behavior.
Here is a small repository to reproduce the behavior:
https://github.com/timbicker/yarn-workspace-bug/tree/main
As I am implementing release automation of React JS project using Jenkins, it is required to download node_modules for a project only once and update successively. It doesn't mean one node_ modules for all projects. But one-time install for one project.
For example, Let's consider a project LoginReactApp.
I have to maintain a workspace like D:/jenkins/workspace/LoginReactApp.
So, I have to check out the source under D:/jenkins/workspace/LoginReactApp/LoginReactApp
and based on the package.json file, I need to download it under D:/jenkins/workspace/LoginReactApp/.
After the release process, the LoginReactApp project source will be deleted under D:/jenkins/workspace/LoginReactApp/ and the node_modules folder will not be deleted.
So, next time it is enough to check out only LoginReactApp project source D:/jenkins/workspace/LoginReactApp/ and it refers to already installed node_modules.
I have tried in command prompt below.
D:/jenkins/workspace/LoginReactApp/LoginReactApp>npm install
--production --f --prefix D:/jenkins/workspace/LoginReactApp/
Is it right? For next time it behaves differently.
How to install node_modules only one time for one React JS project?
I`m using Vaadin version 14.1.5
According to migration guide, it not needed to add package-lock.json to version control, if I don`t edit it
But today, without any changes in vaadin version, versions in package-lock.json was updated automatically, and out UI was broken without any changes by hands, just on next rebuild.
Why is this happened? Does it means, that I should always commit my package-lock.json stable version? Or what is correct pattern for working with dependencies in vaadin?
There is a regression in a transitive dependency release from last night used by Webpack to build the frontend files (affecting modern ES6 browsers in this case).
In case you remove the package-lock.json file in your 14 / 15 project, you will likely get a broken frontend build artifact for production build (output of build-frontend).
We are shipping fixes for 14.1 & 14.2 and 15.
In case you have removed the lock file and you need to build things today, you can workaround this by adding the following pin to the package.json:
"terser": "4.6.7",
We are taking steps to make sure this does not repeat - that the dependencies used by the frontend build (not in the app itself) are also locked and can be relied on.
I have a asp.net mvc 5 project that utilizes npm for package management.
I include node_modules directory in output and publish my project.
I then upload my project on a plesk host.
The file(s) in the Script directory load successfully, however files that are in the node_modules directory do not load.
When I rename the node_modules directory to Modules it fixes the problem. However, this is not my answer.
Where is problem? plesk does not find node_modules?
Is there some permission policy in plesk that may be causing this issue?
Why do you want to pack the node_modules? Is it not supposed to be installed by npm based on your package.json dependencies when your package is being installed or brought in as a dependency by other packages ¯_(ツ)_/¯
On a side note, even if you want to pack node_modules, is there an .npmignore or a .gitignore having a node_modules entry in it?
I'm building an angular2 app, and I've developed a build profile in TFS to auto-build it.
There are four npm commands:
npm install angular-cli -g
npm install
npm run typings (executes typings install)
npm run build (executes ng build)
And then a Copy Publish Artifact step.
However, even when every step passes, it says Finishing Copy and Publish Build Artifacts, the project has been built, and the files have been moved, the actual build never finishes. I've tried breaking those npm commands into a powershell script, having them as NPM commands within TFS, and running them as CMD commands, but the same thing happens every time. Also, if I just remote into the build server and run the commands by hand, it works just fine.
Any ideas?
We've gone through the same headache recently, and I'd strongly suggest you not rely on TFS Build to restore npm packages. Even when you get that right, it takes long and doesn't deploy the node_modules you need to IIS.
Instead, use WebPack to bundle up your node_modules into a bundle.js.
Reference this in your projects/scripts folder and check it into source control.
Remove any npm install steps in your build process (it won't be required anymore since you're referencing the bundle.js now).
This will increase your quality (no future package version surprises), and speed up your deployment (no need to download npm packages on each build anymore).
It's fairly quick to get Webpack installed and you'll save yourself headaches :)