简体   繁体   English

使用 npm 从任何位置安装,而无需每次都制作新的 package-lock.json?

[英]Using npm install from any location without making new package-lock.json everytime?

I'm using visual studio code.我正在使用视觉工作室代码。 I have multiple folders and package.json is in ProjectName/ProjectName.Web folder.我有多个文件夹,package.json 在 ProjectName/ProjectName.Web 文件夹中。

Do i have to enter this folder in terminal everytime i want to run npm install?每次我想运行 npm 安装时,我是否必须在终端中输入此文件夹?

When I'm trying to do it from ProjectName folder which is deafult location in terminal in vs code it creates package-lock.json in this main directory.当我尝试从 ProjectName 文件夹中执行此操作时,该文件夹是 vs 代码中终端中的默认位置,它会在此主目录中创建 package-lock.json 。 Is it possible to maybe change npm config so it knows where the package.json and package-lock.json is so it doesn't create new package-lock.json every timeand it works from other directories in project? Is it possible to maybe change npm config so it knows where the package.json and package-lock.json is so it doesn't create new package-lock.json every timeand it works from other directories in project?

package-lock.json will be created every time you run npm install .每次运行npm install时都会创建package-lock.json It's not recommended, but you can disable the package-lock.json generation, check here https://codeburst.io/disabling-package-lock-json-6be662f5b97d , i hope it helps you不推荐,但您可以禁用package-lock.json生成,查看此处https://codeburst.io/disabling-package-lock-json-6be662f5b97d ,希望对您有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM