npm을 사용하지 않고 node.js 모듈을 설치하는 방법은 무엇입니까?
노드의 github 페이지에 나열 되어 있지만 npm-registry와 함께 게시되지 않은 모듈이 꽤 있습니다. 이 모듈은 npm을 사용하여 설치할 수 없습니다.
이 nodejs 모듈을 Git에서 복제 한 후 설치하는 올바른 방법은 무엇입니까?
github에서 소스를 다운로드해야합니다. 메인 파일을 찾아 메인 파일에 포함시킵니다.
이에 대한 예는 여기에서 찾을 수 있습니다.> node.js 모듈을 수동으로 설치하는 방법?
일반적으로 소스를 찾아 package.json 파일을 거쳐야합니다. 메인 파일이 무엇인지 찾을 수 있습니다. 응용 프로그램에 포함시킬 수 있습니다.
앱에 example.js를 포함합니다. 응용 프로그램 폴더에 복사하여 기본 js 파일 상단에 추가하십시오.
var moduleName = require("path/to/example.js")
이 모듈은 npm을 사용하여 설치할 수 없습니다.
실제로 이름 대신 로컬 경로를 지정하여 모듈을 설치할 수 있습니다. 리포지토리에 유효한 package.json
파일이 있으면 작동합니다.
유형 npm -l
과 예쁜 도움말은 다음과 같이 나타납니다.
CLI :
...
install npm install <tarball file>
npm install <tarball url>
npm install <folder>
npm install <pkg>
npm install <pkg>@<tag>
npm install <pkg>@<version>
npm install <pkg>@<version range>
Can specify one or more: npm install ./foo.tgz bar@stable /some/folder
If no argument is supplied and ./npm-shrinkwrap.json is
present, installs dependencies specified in the shrinkwrap.
Otherwise, installs dependencies from ./package.json.
내 눈을 사로 잡은 것은 : npm install <folder>
내 경우에는 mrt
모듈에 문제가 있어서 (임시 디렉토리에서)이 작업을 수행했습니다.
레포 복제
git clone https://github.com/oortcloud/meteorite.git
그리고 나는 다음과 같이 전 세계적으로 설치합니다.
npm install -g ./meteorite
팁:
다음과 같은 방법으로 repo를 로컬 npm 프로젝트에 동일한 방식으로 설치할 수 있습니다.
npm install ../meteorite
또한 개발 패치가 필요한 경우 리포지토리에 대한 링크를 만들 수도 있습니다.
npm link ../meteorite
github에서 node_modules 디렉토리로 코드를 다운로드하십시오.
var moduleName = require("<name of directory>")
그렇게해야합니다.
모듈에 종속성이 있고 package.json이 있으면 모듈을 열고 npm install을 입력하십시오.
도움이 되었기를 바랍니다
You can clone the module directly in to your local project.
Start terminal. cd in to your project and then:
npm install https://github.com/repo/npm_module.git --save
Step-by-step:
- let's say you are working on a project
use-gulp
which uses(require
s)node_modules
likegulp
andgulp-util
. - Now you want to make some modifications to
gulp-util
lib and test it locally with youruse-gulp
project... - Fork
gulp-util
project on github\bitbucket etc. - Switch to your project:
cd use-gulp/node_modules
- Clone
gulp-util
asgulp-util-dev
:git clone https://.../gulp-util.git gulp-util-dev
- Run
npm install
to ensure dependencies ofgulp-util-dev
are available. - Now you have a mirror of
gulp-util
asgulp-util-dev
. In youruse-gulp
project, you can now replace:require('gulp-util')...;
call with :require('gulp-util-dev')
to test your changes you made togulp-util-dev
참고URL : https://stackoverflow.com/questions/5786433/how-to-install-a-node-js-module-without-using-npm
'IT story' 카테고리의 다른 글
플라스크의 '종점'이란 무엇입니까? (0) | 2020.08.07 |
---|---|
MongoDB와 Cassandra에 대해 이야기 할 때 "문서 지향"과 키-값의 의미는 무엇입니까? (0) | 2020.08.06 |
VB.NET과 C #의 값에 대해 null을 검사하는 데 차이가있는 이유는 무엇입니까? (0) | 2020.08.06 |
Android Studio에서 테스트를 작성하려면 어떻게해야합니까? (0) | 2020.08.06 |
Github에서 풀 요청을 기본값과 다른 브랜치로 병합 (0) | 2020.08.06 |