I need help understanding the npm process? - npm-scripts

I'm using Visual Studio and I push all my code to github for school projects. I was wondering if I have to run npm run build every time I change code for commiting? Thanks

Related

I can't run this project in react-native

I need help please, I can't run this project, I have used the README commands, but I only have errors, could you tell me how to run the project please, I use windows 11.
project link: https://github.com/Pau1fitz/react-native-football
I did what the README says, but it gives me an error

Install NPM modules on current project while offline

this question might seem stupid but I'm looking for a solution to this scenario:
Let's say I'm starting a new project at an offline environment and I have some npm packages installed globally on my laptop and I'd like to use them for a new project I just created.
For example: I've used npm i -g create-react-app and now I'd like to use create-react-app to make a new react app but I'm currently offline.
I've tried to follow an "offline npm" solution where I basically create an npm server on my computer but I didn't manage to make it work, and am not sure if this will give me the solution I'm looking for.
Sorry if this was answered before, I couldn't find a solution.
Thanks in advance!
You can try run
create-react-app youproject
when you are offline. For me, this sometimes work, sometimes not.
Other solution is install offline all packages, defined in package.json file. You can do this, if you have this packages installed in online mode.
So you can try install this packages, using:
npm link packagename
or
npm i './path_to_package_in_user_directory' // yes, you can also install packages from folder
This solution is also ok, when you try add new packages to existing project. Sometimes this causes error and you need reinstall all packages (that's big pain), but most of all, works good.

Trying to use npm with .net core to use i.e. Bootstrap

I'm trying to build an aspnetcore mvc-app from a console-app and I'm no comfortable with implementing the Program.cs and Startup.cs classes, adding the controller, action and view.
So now I'm ready to start working with frontend and I thought that I should learn a good package-manager and workflow to add front-end packages to wwwroot/lib. As I've understood it npm (and webpack) are highly recommended for this (unless I'm mistaken).
I have a hard time finding a tutorial teaching me how to do this though, most of them introduce several concepts (Angular, Typescript, Yeoman Gulp, etc.) that confuse me as to whether I'm learning what I'm looking for.
I asked this question and thought I'd start with a workflow rughly like this:
Run npm init in my project folder (adding a node_modules folder to the project)
Run npm install bootstrap --save. This will install the NPM module in a node_module folder.
Manually copy the bootstrap-module from my node_module to wwwroot/lib through the cp command.
Now this doesn't feel right or "correct" I'd love to look into WebPack which was suggested in my previous question as a way to do bundling (which I must admit I haven't learned yet) for step three.
So my general question would be if this seem to be a reasonable approach to start out with or if it's seriously flawed compared to how it's supposed to be done?
A specific question is what is the npm entry point? The default is Index.js but is this right for a dotnet mvc-app? As you might notice I'm a bit confused as to where to look for answers for my problem so hope if there's no good answer you might be able to point me in the right direction? :)
EDIT: PS, Using Visual Studio Code (my computer can't handle Visual Studio) so can't use tools unique for VS.

Visual Studio 2017 not restoring packages on save

IN VS2017 I have a quick node.js "Hello world" project. The installed template for node.js includes using NPM via an included package.json I am editing the package.json file to include new dependencies. Upon saving package.json VS is supposed to install any new packages that are included.
I started with the project template: Other Languages\TypeScript\Node.js
I confirmed that the option is enabled for Restoring npm packages on save of package.json
But no matter what changes I make to package.json VS won't run npm and install the missing packages. Also if I build or run VS won't automatically install the missing packages. I can right click on npm and select Install Missing Packages which does work.
What am I missing?
Restore on Save for NPM packages currently doesn't work in NPM projects. I'm still tracking down the root issue, but I did come across a discussion where they (the NTVS folks) wanted to opt out of some behaviors for Web projects.
There are some context menu options on the npm or individual package nodes to restore/update/etc. You could also create new keyboard shortcuts for these context menu items, but I don't know of a way to make Ctrl+S work.
I'm following up internally to revisit these decisions, but in the meantime, send in feedback so that we have some customer data to point to!

How to maintain semantic-ui?

I installed semantic according to the document:
npm install semantic-ui --save
cd semantic/
gulp build
If I customised the variables how can I maintain them? For example, if I npm update semantic some day, my change would be gone by the semantic upgrade.
How do you guys maintain semantic-ui in your projects?
You can have a copy of your files outside semantic and write a gulp task to move it.
Every time you update semantic, you can just run this task again, and then run a gulp build inside semantic.