Build npm package in Windows pre build in Linux - linux

I have a downloaded a project which has been developed and previously build in npm in Linux environment. I want to build and use it in Windows environment. Other than the dependencies shown in the package.json file there were few other dependencies error like bower, grunt etc. which I solved it manually.
I am not able to build and run it.
Can anyone please suggest the steps for building and running the package in Windows environment.
Thanks

Related

When we build any freestyle project in Jenkins, does Maven comes into picture in the background?

Maven requires a POM.XML file for installing dependencies, but if we have a NodeJS application, the dependencies are mentioned in the node modules folder, and for normally installing them we do npm install. So if we are using Jenkins and created a freestyle project for automating the installation of dependencies, will this freestyle project use Maven for building and installing the dependencies?
If yes, then what happens in the background? Any POM.XML file is created for the dependencies mentioned in node modules?
A freestyle project is, as name suggests, a free style. You have to configure everything from SCM, Build Environment, Build triggers, Execution and Post job execution if any.
This means, the job is independent of the language/build tool you have for your source code.
If you have node and using npm, configure Build execution as npm install.
If you have java and using ant, use ant -f build.xml.
If you have java and using maven, use mvn clean install.
and so on...
Whatever you configure as a build execution, that task will be executed in background and accordingly, required package(s) will be generated.

SPFx development setup offline

Is there anyway we can setup SharePoint framework development environment offline without internet connection?
Following this instruction,
https://learn.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-development-environment
It failed on the second step,
npm install -g yo gulp
If your node modules were already installed, then yes, you can develop offline. But the npm install command very specifically downloads and installs the package you specify.
If you can find a colleague who already has those modules installed and you can copy from their machine to yours, you could potentially get it setup without an internet connection, but you are going to have to get those SPFx packages (Yeoman Gulp and Microsoft Generator) from somewhere.

npm install as a build step in TeamCity

I am studying a TeamCity project which has to do with a .NET application with Angular at the frontend. What it does not make sense to me is I cannot find anywhere npm install. For example:
The thing is in case I add a dependency in package.json which requires update of node_modules folder, everything works fine as far as the artifacts are concerned and Angular finds the files it needs!!
But how node_modules folder on TeamCity is updated?
Sorry, for being a little bit abstract; honestly, I cannot find npm install anywhere.
I would highly recommend looking at the TeamCity Node Plugin available at https://github.com/jonnyzzz/TeamCity.Node. The plugin, which is also available via the TeamCity Plugin repository for an integrated installer, will allow you to use NVM to install a specific version of Node as well as run NPM to install other dependencies, etc.
I hope this helps!

Install NodeJS package without npm

Question:
How to install NodeJS package (like grunt-cli) manually without using npm?
Environment:
I have installed Windows 10 with "Bash on Ubuntu on Windows".
I have successfully installed NodeJS + Grunt in the "normal" Windows environment without Bash.
NodeJS is installed in the bash environment (Linux-subsystem)
Grunt is not yet installed in the (Linux-subsystem)
Background (why):
My colleague's grunt tasks was developed for an Ubuntu environment and calls bash commands directly which obviously does not work in a "normal" Windows environment. This is an experiment to see if it is possible to run his grunt tasks in "Bash on Ubuntu on Windows" however, I am stuck on the part where npm tries to download the packages (network libraries are not yet supported by Linux-subsystem so commands like curl does not work).
I am hoping to "skip" the download part of npm by manually copying the downloaded version from the Windows environment (or GitHub) into the "node_modules" directory in the Linux-subsystem.
However, I do not know how to configure npm that there was a new package added and that it may use that package now.
You can copy all the packages you need with dependencies into node_modules directory and it will work fine.
I think the best way is install packages using npm on a "normal" computer. Then copy the node_modules directory on "normal" computer to your target directory.
Pre-built installer is now available in all platforms in the official website
https://nodejs.org/en/download/
You no need to install modules when node_module dir is available. If project is cloned from version control (GIT) Repository or node_modules folder is not available you should run below command
npm install
Otherwise you need to insert node_modules manually to your project.
you can also download node_modules from other computer and copy modules to your project
npm install --save <PACKAGE NAME>
Then you can find you dependency modules in your console folder.copy those files to your folder.

How to check out a JHipster project in multiple development environments

I'm evaluating JHipster; it looks great for rapid development!
Maybe a novice question: I see that the generated .gitignore ignores certain things, e.g.
/node/**
/node_modules/**
So, if I check in the generated project to a repository, and then some other developer in my team checks it out in his environment, the project would not work in his environment. Would it?
Was curious to know how to handle this. Thanks.
Since your git repo won't track node packages, others using your git repo will need install node.js, then run npm install to download all the node packages.
It's similar to them having to have java and maven installed on their environment.
Update: A developer will run 'git clone '. The source (not including node or bower) will be on their workstation. Once they've installed node.js, they'll run 'npm install' and the node directories will be created automatically for your project by downloading them from the Internet. That way you don't need to keep all your node libraries in your own git repository ...just their package name and version in the package.json file (similar to maven dependencies in pom.xml).
No one should commit the node_modules or bower_components to git, what you would do is share the project like you share the maven projects.
Write in the read me what needs to be done to get them ready, for example the installation of yo, bower, grunt or gulp and generator-jhipster.
What is very nice about liquibase, each developer can have his own version of the database, and every commit has its own database version.
What we our team does, if a developer adds something to node js package.json then we mention it in the comment: npm install needed and the same applies for bower.
That way you keep all your environments clean, and if you would like to install continuous integration like "Jenkins or Teamcity" then you make sure Jenkins is building rebuilding the whole project.

Resources