how to Add my node_module, modules into package.json

前端 未结 4 2136
我在风中等你
我在风中等你 2021-02-19 07:42

I have some module in my node_module folder but because I am amateur in nodejs, when I wanted to install theme, I forgot to use --save with npm i

4条回答
  •  时光取名叫无心
    2021-02-19 08:22

    Its simple. Edit the package.json file and add the following for development dependencies:

    "devDependencies": {
        "broccoli-asset-rev": "^2.0.2",
        "broccoli-merge-trees": "^0.2.1",
        "broccoli-svg-sprite": "^1.0.3",
         ......
    }
    

    To get a list of package names and version numbers, you may look at node_modules/module folder/package.json for each of the modules to pick up the official package name and version. It will be of the form:

        {
      "name": "<>",
      "version": "2.1.0",
      "description": "broccoli asset revisions (fingerprint)",
    ....
    }
    

    just copy the name and version information from above into devDependencies into your project's package.json and you should be good to go.

    Also have a look here Is there a way to automatically build the package.json file for Node.js projects

    and here: https://docs.npmjs.com/files/package.json

提交回复
热议问题