Questions tagged [npm-pack]

"npm pack" is a command on npm CLI, which creates a tarball from a package.

Reference:

27 questions
7
votes
1 answer

How does npm run build work with npm pack?

I'm working on a project that requires using the npm pack command. Is running build on the library/package required before creating the installable tar file? Or can I just pack and then install it into the app?
Alex Nelson
  • 359
  • 1
  • 3
  • 14
6
votes
0 answers

How to NPM publish so that consumers can imports from different top-level directories

I am publishing a library to NPM. The library was written in Typescript, and the result of the Typescript compilation is put in a lib/ folder. The main file is an index.ts that exports my public API: export * from './functions'; export * from…
BeetleJuice
  • 39,516
  • 19
  • 105
  • 165
5
votes
1 answer

npm pack doesn't follow .npmignore

my package tree: LICENSE README.md main.js package.json - node_modules - m foo.wasm package.json I want to npm pack to include the node_modules/m, the private module not be published to npmjs. Here is my…
fannheyward
  • 18,599
  • 12
  • 71
  • 109
3
votes
2 answers

How to pack latest changes using npm pack?

I am trying to test one of the package locally. What I do is go the root directory of my package and run npm pack It creates .tgz file and I install this file via npm i . Now I found that some of my recent changes are missing in this…
Gaurav Chauhan
  • 1,295
  • 4
  • 17
  • 41
3
votes
0 answers

npm pack brings unnecessary files of locally-bundled dependencies

I have a project and it depends on a local lib package. Let me show you pakage.json { "name": "myproject", ... "dependencies": { "local-lib": "file:../local-lib" } ... "bundledDependencies": [ "local-lib" ] } And the…
3
votes
1 answer

lerna publish and npm pack failing to package all the files in "dist" folder

I am trying to build my first Angular Component package using lerna and it was working pretty well until I realized I had to add "ng-packagr" to get all of the HTML bundled inline with the rest of the code. After adding that support and getting it…
Matt Hintzke
  • 7,744
  • 16
  • 55
  • 113
2
votes
1 answer

error relative path global package nodejs

I create a package with several choices and depending on the choice I run a bash script .sh with execFile from node it works fine locally with the path "./utils/myScript.sh but when I create the package with npm pack and install globally it cannot…
2
votes
0 answers

Bundled local dependencies in package throw errors on npm install

I am trying to publish a package that relies on an unpublished package, which needs to remain unpublished. I thought I had a solution: In development, the relative path is hardcoded in the package.json: { ... "dependencies": { …
Ned
  • 237
  • 3
  • 12
2
votes
1 answer

`npm publish` ignoring new additions to .npmignore

While building create-near-app, artifacts get created within the project tree. Some of these were added to a .npmignore file, but others were missed until I attempted to publish a new version and noticed that the npm package would be several hundred…
chadoh
  • 4,343
  • 6
  • 39
  • 64
2
votes
0 answers

Custom NPM Package: Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but

I am trying to publish my React component to npm and running into the following error when trying to import my packaged component into another project: Error: Element type is invalid: expected a string (for built-in components) or a class/function…
Rishi Prasad
  • 69
  • 2
  • 9
2
votes
2 answers

npm pack/publish won't pack .gitignore or .npmrc files

I have built a project generator for my company. It's a globally installed npm package, that when run, takes the entire contents of a /template directory inside the package and copies it to the user's chosen destination. Inside /template I have 2…
Titan
  • 5,567
  • 9
  • 55
  • 90
2
votes
3 answers

Npm pack to include local modules

I have some local modules that I want to include in my package to be sent to a server. Since these local packages are not on the npm registry, they need to be part of the package. I have tried some ways to get the node_modules folder included in the…
Bastiaan
  • 686
  • 1
  • 8
  • 20
1
vote
0 answers

How to pack typescript npm package containing interfaces

In my project I want to implement a custom npm package containing my typescript code (classes and interfaces). The interfaces inside the package should be used by different projects outside the package itself. Right now my package contains following…
Febertson
  • 398
  • 4
  • 23
1
vote
0 answers

Remove development specific entries from package.json when running npm pack (or pnpm pack)

I have a package.json with this kind of content: { "name": "smoketest", "version": "0.0.1", "main": "dist/index.js", "files": [ "dist" ], "scripts": { "run": "node dist/index.js", "build": "rm -rf dist && NODE_ENV=production…
user3612643
  • 5,096
  • 7
  • 34
  • 55
1
vote
1 answer

Files missing with npm pack

I am building a npm module, in which I want to include two directories : /dist and /demo. So far, my approach was to use the 'files' attribute, in package.json : "files": [ "dist", "demo" ] When running npm pack, the tgz files successfully…
sulDu
  • 21
  • 7
1
2