[英]npm package not installing as expected
我是NPM和angular2的新手,我试图创建自己的NPM软件包并将其安装在本地。 我设法创建了包含以下内容的程序包(test-package-0.0.1.tgz):
├── .npmignore
├── README.md
├── LICENSE
├── index.html
├── package.json
├── main.js
├── styles.css
├── tsconfig.json
├── typings.json
├── app
│ └── app.component.ts
│ └── app.module.ts
│ └── main.js
│ └── main.ts
但是,当我尝试将其安装在其他目录中时,我只会得到一个node_modules
文件夹。
我正在使用npm pack
创建test-package-0.0.1.tgz
然后npm install C:\\otherfolder\\platform-core-webui-0.0.1.tgz
安装软件包。
这是我的package.json
文件的内容,该文件在Windows环境中运行。
{
"name": "test-package",
"version": "0.0.1",
"description": "Test package",
"author": "me",
"publishConfig": {
"registry": "http://localnpmrepository/npm"
},
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "UNLICENSED",
"dependencies": {
"@angular/common": "~2.0.2",
"@angular/compiler": "~2.0.2",
"@angular/core": "~2.0.2",
"@angular/forms": "~2.0.2",
"@angular/http": "~2.0.2",
"@angular/platform-browser": "~2.0.2",
"@angular/platform-browser-dynamic": "~2.0.2",
"@angular/router": "~3.0.2",
"@angular/upgrade": "~2.0.2",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
"devDependencies": {
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3",
"typings": "^1.4.0"
},
"main": "main.js"
}
我希望安装后能看到完全相同的文件夹结构,而不仅仅是node_modules
文件夹。 我要去哪里错了?
我相信我可能误解了创建自己的包/模块的机制! 模块是关键字,当然,当我安装platform-core-webui-0.0.1.tgz时,它已将自身安装在node_modules
文件夹中,现在我需要将其import
到要使用的组件中。 这样就回答了我的问题:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.