npm install not creating a new package-lock.json

后端 未结 5 417
醉梦人生
醉梦人生 2021-02-01 12:49

I accidentally deleted my package-lock.json file. npm install is not generating a new one. How do I get npm to recreate this file.

5条回答
  •  礼貌的吻别
    2021-02-01 12:59

    To resolve this issue I have tried below mentioned things and it worked for me :

    Make sure your package-lock globally enabled, you can enable it using:

    npm config set package-lock true

    To make sure your .npmrc is not blocking the creation of package-lock file, set this to your .npmrc

    echo 'package-lock=true' >> .npmrc

    note: package-lock.json is automatically generated for any operations where npm modifies either the node_modules tree, or package.json for npm -v > 5.x.x.

    check your npm version: npm -v

    update your npm to latest version using:

    npm install -g npm@latest

    npm i -g npm-upgrade

    @will

提交回复
热议问题