Questions tagged [npm]
npm is the package manager shipped with Node.js. It can be used to install and publish CommonJS and ECMAScript modules, jQuery plugins, reusable JavaScript code (libraries), JavaScript-based CLI programs, and more.
21,807
questions with no upvoted or accepted answers
34
votes
2
answers
13k
views
Looking for a Dual Listbox with AngularJS and Bootstrap
I am looking for a component like this to be included in my project:
http://geodan.github.io/duallistbox/sample-100.html
I want to install it with npm.
The problem is that I tested some of the ...
29
votes
1
answer
676
views
StriderCD global post install fails on bower access to $HOME/.config $HOME/.cache
I am trying to work out the best way to install StriderCD globally. I installed node and npm via the global-enabled fork of nvm, and all paths are working fine for other builds, but none of them ...
23
votes
2
answers
11k
views
How do I install dependencies for a single package when using npm workspaces?
Using npm workspaces I have a folder structure like this
+-- package.json
+-- package-lock.json
+-- client
| `-- package.json
+-- shared
| `-- package.json
`-- server
`-- package.json
...
22
votes
1
answer
2k
views
How to split chunks when authoring libraries with webpack 4?
I'm trying to publish a custom react component to a private repository.
I use react-loadable to load a subcomponent on demand. When running locally, everything works fine. The index.js file ...
21
votes
1
answer
3k
views
Why must I run "npm install" twice for my package to install successfully
The first time I "npm install" package_1, I get the following error.
npm ERR! path C:\Users\john_\Documents\GitHub\why_npm_nesting_fails\package_1\node_modules\.staging\bignumber.js-55edd243
I don't ...
17
votes
3
answers
3k
views
Different package versions for Android and iOS
I am developing an app for both Android and iOS using React Native.
One of the libraries I'm using is a bit problematic because the app only compiles correctly:
...on Android when using "react-...
16
votes
1
answer
5k
views
(Handle Polyfill.io Security-Alert) How do you detect if a big npm Codebase uses Polyfill.io somewhere?
Polyfill.io is malicious: https://dev.to/snyk/polyfill-supply-chain-attack-embeds-malware-in-javascript-cdn-assets-55d6
I now need to find it my codebase:
I used: grep -r "polyfill.io" to ...
15
votes
1
answer
5k
views
Using --ignore-scripts for one dependency in NPM
Following this question, NPM dependencies can be installed using:
$ npm install --ignore-scripts
Is there a way to mark that a dependency should be installed without running scripts in package.json?
...
15
votes
2
answers
4k
views
Generate declaration file with single module in TypeScript
Given the following folder structure:
src/
├── foo.ts
├── bar.ts
├── baz.ts
├── index.ts
Where foo.ts, bar.ts, and baz.ts each export a default class or thing: i.e. in the case of foo.ts:
export ...
14
votes
0
answers
885
views
Can a package be published to both github and npm? (with a single `npm publish`)
I got access to the github package registry beta, just fiddled with it and followed the configuration steps to publish.
The thing is, I published it correctly, but noticed it didn't publish to npm. ...
14
votes
2
answers
1k
views
Issue adding third-party (external ) js lib in angular5
I am working on to add jsplumb community js library version with the angular 5 application (Angular CLI: 1.6.1).
With the first build without any configuration to tsconfig.json I get the following ...
13
votes
0
answers
544
views
Is there a way to prevent npm from creating symlinks of workspace packages inside node_modules?
We are working on a monorepo that uses npm workspaces. One of the directories in this project is special in the sense that we don't want to allow packages within this directory to create imports to ...
13
votes
0
answers
487
views
npm workspaces - skip `src` folder when importing source files from symlinked shared package
I have a typescript monorepo setup that uses npm workspaces and I want to be able to import subpaths down to any individual typescript file of @package/shared in @package/client and @package/server ...
13
votes
2
answers
9k
views
WebPack - TypeError: __webpack_modules__[moduleId] is not a function (development) // Error: Invalid hook call (production)
I'm struggling with a WebPack error that occur when I use my custom library hosted as a package and streamed with NPM Link. Meanwhile, the production version works perfectly
Here is my scripts
"...
12
votes
0
answers
4k
views
PhantomJS attempting to install as if OS is Linux/arm64 when I am using Mac Big Sur?
I am receiving the below error message when running npm install on a project:
#10 35.10 PhantomJS not found on PATH
#10 35.10 Unexpected platform or architecture: linux/arm64
#10 35.10 It seems ...
12
votes
1
answer
8k
views
ElectronJS: Must use import to load ES Module
I've just started learning Electron from Electron Docs. I used ES6 (import/export) while they used require.
I've added type:module in my package.json and also I've changed the js extension to mjs, but ...
12
votes
2
answers
4k
views
Critical dependency warning when using react-pdf
I'm trying to display a pdf on a react application and i get the following warning:
/node_modules/react-pdf/node_modules/pdfjs-dist/build/pdf.js
Critical dependency: require function is used in ...
12
votes
0
answers
662
views
Should polyfills be a dependency or a devDependency?
As explained by this SO post, polyfills should be in the dependency folder.
However, the Array.find() polyfill has the following installation instructions.
npm install --save-dev jspolyfill-array....
12
votes
0
answers
9k
views
How do I install the highcharts NPM packages in non-interactive mode?
I am trying to install highcharts server in my Docker image. But the NPM install command asks several questions to the user when installing. I need it to go ahead with default values(Which I can ...
12
votes
1
answer
1k
views
How can i Deploy a single npm workspace which depends on packages and other workspaces?
I created a project using npm workspaces and Typescript Project References pretty much exactly like this example repo: https://github.com/Quramy/npm-ts-workspaces-example.
This setup keeps all ...
12
votes
1
answer
5k
views
peerDependencies configuration for publishable libraries with NX & Angular
I have a monorepo using NX & Angular and I am publishing some libs to NPM and i have the following scenario
apps
only_App
libs
lib_A // v1.0.0
lib_B // v1.0.0
lib_C // v1.0.0
lib_A ...
11
votes
1
answer
7k
views
React UnhandledSchemeError - "node:buffer" is not handled by plugins
I'm trying to use a package in my React project that will allow me to make API calls (axios, node-fetch, got etc.)
When these packages are not installed, the app runs properly. When any of them are ...
11
votes
1
answer
8k
views
Fix for vulnerability - "Critical Prototype Pollution in immer" Patched >=9.0.6
Here's a fix for the following vulnerability:
Critical Prototype Pollution in immer
Package immer ...
11
votes
1
answer
4k
views
Getting error while installing [email protected]
I'm working on an old node project and while doing npm install I'm getting errors
Node version: v13.8.0
Npm version: 6.14.4
Mac OS Version: 10.15.5
At first, I was getting the X-Code issue that I ...
11
votes
0
answers
2k
views
Allowing deep imports from npm packages without a build directory (like lib/dist) in the path
The standard approach when packaging code for npm is to place transpiled or bundled code in a separate lib, dist or build directory and to set the package.main property (and module/browser) to point ...
11
votes
1
answer
6k
views
npm equivalent of yarn install --check-files (or yarn check)
Update for 2020
This question originally referred to the yarn check command, but the docs state that this is deprecated in v1, and removed in v2, and yarn install --check-files should be used instead.
...
11
votes
0
answers
5k
views
npm ERR! ELOOP: too many symbolic links encountered (cordova-plugin-app-event broken symbolic link)
my problem is found in the title. I try to open an Ionic project, which uses ionic-native/barcode-scanner. But if I try to install anything with npm, this error occurs:
npm ERR! ELOOP: too many ...
11
votes
0
answers
538
views
npm webpack how to configure to use non minified dependencies
I received a notification from Google regarding an extension that I have in the web store.
We routinely review items in the Chrome Web Store for compliance with
our Program policies to ensure a ...
11
votes
0
answers
2k
views
Keep symlinks when running `npm install`
If we do:
npm link x
and then we run npm install, it will overwrite the symlinked package.
Is there a way to run npm install without overwriting a symlinked package? something like:
npm install --...
11
votes
0
answers
1k
views
Target specific file/folder inside git repo on package.json
I have a package.json with a dependency that instead of targeting a npm package is using a own house repo, we have something like this:
"myDependency": "git+https://fantasticUrl/_git/repoName"
What ...
11
votes
0
answers
3k
views
How to generate per-package package-lock.json for existing Lerna mono-repo
We have an existing Lerna mono-repo that has a structure like:
/
/packages
/package1
/package2
/package3
...
We currently use Yarn for our project, and actually only have a top-...
11
votes
0
answers
1k
views
How can I move existing npm package to a new organisation?
I created a npm organisation org, How can I move existing <org>-<xxx> packages into my org.
11
votes
0
answers
5k
views
Npm project inside another npm project
I want to organize my project to easily reuse some modules. I am not sure that my approach is correct.
Let's say we have a main project with two sub-projects. Something like this:
- main-project
- ...
11
votes
1
answer
3k
views
Why does "npm install" modify package-lock.json? Why commit it to git then?
When I run "npm install" in a project it often modifies package-lock.json, for example if I work on the same project from another computer (with different node or npm version).
But at the same time ...
10
votes
0
answers
2k
views
Where is @mediapipe/camera_utils npm module source code?
MediaPipe project's source code is hosted at https://github.com/google/mediapipe
We can use MediaPipe using JavaScript also in Browser given at MediaPipe in JavaScript
While using MediaPipe with ...
10
votes
0
answers
9k
views
npm install hangs at " reify:tailwindcss: timing build:queue Completed in 141ms"
It always hangs at the same place: reify:tailwindcss: timing build:queue Completed in [number]ms
I've even tried just walking away and leaving it overnight to no avail. What's really frustrating is ...
10
votes
0
answers
1k
views
Unable to fetch user data by using tiktok-scraper npm package
I have used tiktok-scraper for getting any public TikTok users data. It was working fine recently and I was able to get the required data but suddenly it stopped working and started giving this error:
...
10
votes
0
answers
874
views
npm run dev returns "Failed: EOF" error on DigitalOcean Apps
I am working to migrate a Laravel web application to DigitalOcean's new App platform. We have been running this application on several machines over the past few months with no npm issues. However, ...
10
votes
1
answer
2k
views
Default values for environment variables in .npmrc
Does somebody know how to set default environment variables in .npmrc files ? I tried to do this:
registry=${myEnvVariable:-https://myregistry.com}
and this:
defaultRegistry=https://myregistry.com
...
10
votes
0
answers
1k
views
Validating npm package.json
I would like to validate my npm package.json files as part of my CI/CD pipeline.
Is there an official schema for the file? I found a pretty dated github project, but it does not seem official.
10
votes
2
answers
7k
views
npm run production error I can't decipher
I can't understand the error when executing npm run production:
$ npm run production
> @ production /var/www/html
> cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress ...
10
votes
1
answer
2k
views
Importing subfolders in a typescript npm package
I'm creating a package for npm but I want it to be imported in the following way:
import myPackage from 'my-package';
import { subFunction1, subFunction2 } from 'my-package/subfunctions';
When ...
10
votes
1
answer
3k
views
Why does npm-shrinkwrap.json change when running npm install
We use NPM Shrinkwrap to lock down dependencies.
Not sure if this is a bug or a feature but when I run: npm install after deleting my node_modules directory everything works but my npm-shrinkwrap....
10
votes
2
answers
2k
views
Angular package with NPM and GIT: dist folder in the repo?
What I want to achieve:
I've created an Angular module and I want to npm install it from my GIT repo (I don't want to use npm publish, because it is a private code) in other projects.
I'm using ng-...
10
votes
1
answer
1k
views
Updating transitive dependencies of a NPM package
Our company has a few web applications which in turn depend on a very long chain of internally created and hosted npm packages (we use JFrog Artifactory) each with their own dependencies (and so on). ...
10
votes
0
answers
1k
views
Cant install LWIP through NPM (ZLIB_VERNUM != PNG_ZLIB_VERNUM)
LWIP could not be installed though NPM.
lwip is being used to create sprites with sprity package
Reading from the log, it states that i need to update some constants (see code below).
In file ...
10
votes
1
answer
1k
views
Specify different Yarn install paths for ‘devDependencies’ and ‘dependencies’
I’m using Yarn to manage my dependencies for my project. I have developer dependencies (devDependencies) required for development and front-end dependencies (dependencies) that my project will require ...
10
votes
1
answer
15k
views
SyntaxError: Unexpected token export
I'm working on a npm package called foobar, locally, to allow me to make changes or modifications in real time without having to publish/unpublish to improve development time and sanity.
In ...
10
votes
1
answer
4k
views
webpack build css rules have different order then in development
I am not sure if this is a webpack issue, vue-loader for webpack issue or just something that I am doing wrong.
When I am running npm run build to build a distribution for my Vue.js application the ...
10
votes
1
answer
3k
views
How to make npm use the lowest version that matches all requirements
We're using NodeJS for some projects and are faced with an issue that must have a simple solution (seeing as nobody else seems to have the problem).
In the packages.json there are a bunch of ...