简体   繁体   English

如何安装全局安装的 npm 包

[英]How to install globally installed npm packages

I wanted to try Vue js but it seems to be very hard for me to import it to my project.我想尝试 Vue js,但我似乎很难将它导入我的项目。 I there a way where you can install the dependencies without using internet (downloading again) which is already installed globally.我有一种方法可以在不使用已在全球范围内安装的互联网(再次下载)的情况下安装依赖项。 Vue 2 is installed globally and I will be using vue init , but it seems that vue init is installing the Vue again from the internet. Vue 2 已全局安装,我将使用vue init ,但似乎vue init正在从互联网上再次安装 Vue。 I want it to take the dependencies from the already installed (globally) and put it in my folder so that I dont use internet.我希望它从已经安装的(全局)中获取依赖项并将其放在我的文件夹中,这样我就不会使用互联网。

Thanks in advance...提前致谢...

You can create a new project dir to store the globally installed package (copy from the installation folder) and after that copy process make a zip of it so that it can be used again, then you have to config some of the files for your project needs.您可以创建一个新的项目目录来存储全局安装的 package (从安装文件夹复制),然后在复制过程之后制作一个 zip 以便它可以再次使用,然后您必须为您的项目配置一些文件需要。

Try install localy and use command尝试在本地安装并使用命令

npx vue <command>

Also check package.json in your project还要检查项目中的package.json

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

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