how to Add my node_module, modules into package.json

前端 未结 4 2122
我在风中等你
我在风中等你 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:34

    Simply change into the directory containing node_modules, backup any existing package.json in there, then use npm init to re-create the package.json.

    The generated package.json will include any modules that already exist within node_modules.

    Sample run:

    $ cd /my/project
    $ mv package.json package.json.bak # Backup package.json
    $ npm init                         # Recreate package.json with dependencies populated
    

提交回复
热议问题