Reference node modules in Angular2 cli project - node.js

I have Angula2 -cli project and set it like the site cli.angular.io guide.
To start with new project I need to run cmd: ng new my-project-name
and the project folder is created with some files and also node_module folder.
How can I avoid the node_module folder creation every time I create a new project ?
Can I just reference to the node.js module that is located in my PC?

The node_modules folder is created to hold dependencies of your project, so you will need that in order to run or test your application.
With that being said, if you'd like to just create the project without installing all of them, you can use the skip-npm argument, but note that you will not be able to run or test your application.
ng new my-project-name --skip-npm

Related

"tmpnodejsnpm-cache" folder is getting created in every project created using npm command

Whenever I create Vue and React projects using npm, it generates a "tmpnodejsnpm-cache" folder in my project directory.
And after deleting this folder also project runs properly but if I hit the "npm i" command again it will again create same folder, I want to get rid of it.

How to create new angular app without downloading node_modules files

I'm new in angular and every time I want to create new angular application it downloads approximately 316MB files from internet.
I was wondering if there is any way to skip downloading node_modules folder and just download other angular files neccessary to run my app and then copy&paste my (existing) node_modules folder to root folder of my app.
you can run the command ng new <YourProjectName> --skip-install, It will create a package without node_modules folder.
Yes, it's possible. Copy package.json, package-lock.json and node_modules. node_modules usually doesn't contain any project specific files or configurations.

Move node_modules folder to different location?

I want to use various cloud sync services to safely backup my project and keep it updated on the cloud. But I do not want to sync the node_modules folder. I am working with a React project setup using create-react-app.
So how can I move the node_modules folder from the project folder to anywhere else on my system? What changes do I need to make in my project files and how can I use npm start to launch hot-reload server like I normally do?

How to develop node library referenced via local directory from another project?

Per this answer, when you reference a local dependency in package.json the local package will be copied to node_modules. This is not ideal when I'm developing a package and just referencing it from another project as I want to verify the library works correctly within another project. It seems every time I make a change to the library, I have to go back to my consuming project, delete the node_modules/my-library folder and rerun npm install each time for it to copy the library back. If I don't delete the folder first it doesn't seem to copy the latest version over.
If I develop directly inside node_modules/my-library it's not ideal because that folder isn't version controller, unlike the local folder referenced in package.json.
Another option would be to create an example project within the my-library repo, but I'd prefer to go that route as a last resort.
You can use npm link to develop your library and have another project use the local version like so.
For example;
In the my-library directory run npm link.
Then in the project you want to use my-libray run npm link my-library.
This will also work with yarn link.

TypeScript and NodeJS Project Configuration

I'm new to nodeJS and as I studying TypeScript I begin to embrace. My problem is how to configure/organize a project. Is there any way to configure a project in TypeScript and NodeJS without using gulp, or any other third party library.
This is my way to create a new project with Node.js and TypeScript from scratch. Assuming you have already installed TypeScript and Node.js.
Firstly, create a new folder for your project.
Open the command line which points to your project folder, type npm init.
The command will ask you some questions relate to your Node.js project. After finishing, a file named package.json will be created in your project folder.
To create TypeScript tsconfig.json file, you can type tsc --init from the command line which points to your project folder. You can then modify tsconfig.json file as you want.

Resources