I am new to NPM and angular2, i am trying to create my own NPM package and install it locally. I manage to create the package alright (test-package-0.0.1.tgz) which contains:
├── .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
However when i try and install it in a different directory i only get a node_modules
folder.
I am using npm pack
to create test-package-0.0.1.tgz
and npm install C:\\otherfolder\\platform-core-webui-0.0.1.tgz
to install the package.
Here is the contents of my package.json
file and im running in a Windows environment.
{
"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"
}
I was hoping to see the exact same folder structure after my install not just a node_modules
folder. Where am i going wrong?
I believe i might have misunderstood the mechanics of creating your own package/module! Module being the key word, of course when i installed my platform-core-webui-0.0.1.tgz it installed itself inside the node_modules
folder where i now need to import
it into a component to use. So that answers my question :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.