How are npm packages managed in nodeter?

I do not understand how node packages in nodeter are managed. When I run nodester npm install <package-name> from the CLI, I do not see any packages in the source folder of the application. Without these packages visible in my folder, I can use them in the usual way (as if I installed them directly in the application folder).

I am not recommended to store packages directly in a folder, as Nodester offers node PaaS for free, and it would be nice not to optimize my application and use minimal space.

Secondly, there is a way by which I can run the application both locally and on the host. How can I tell git not to push locally installed git modules. I heard something like git ignore . How do I control git to ignore so that local packages are not clicked on nodeter?

Perhaps I was not eloquent in the question, because I am new to node so that anyone who could put my question for the better do not hesitate to Change this .

+4
source share
1 answer

Generally, the best way is to add the node_modules directory to your .gitignore file. My .gitignore looks like this for my node projects:

 *.sw* .DS_Store node_modules 

The first line ignores any temporary Vim files, the second ignores the OSX.DS_Store files, and the last ignores my node_modules directory. You will need to remove your node_modules directory from your repo using git rm if it has already been executed.

More re explanations. gitignore files here from github.

So make Git neglect your node_modules, awesome. Secondly, you will need to create a package.json file. This is what npm (and Nodester) says, what your application depends on.

 { "author": "Mr Awesome", // This is your name :) "name": "my_awesome_app", // This is your apps name "description": "More awesome than most other apps.", // What your app does "version" : "0.0.1", // Your apps version (increment this when you deploy) "node": "0.6.12", // The version of node you want Nodester to run your app on "dependencies": { "connect" : "2.0.3", // depend on version 2.0.3 of connect "express" : "*" // depend on the latest version of express } } 

More information on package.json formats can be found here :

When you click on nodeter, you should read package.json and install your dependencies.

Hope this helps!

+2
source

Source: https://habr.com/ru/post/1403958/


All Articles