All Questions
Tagged with npm javascript
10,142
questions
1909
votes
8
answers
332k
views
What is the difference between Bower and npm?
What is the fundamental difference between bower and npm? Just want something plain and simple. I've seen some of my colleagues use bower and npm interchangeably in their projects.
1765
votes
36
answers
2.9m
views
How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)
My version of node is always v0.6.1-pre even after I install brew node and NVM install v0.6.19.
My node version is:
node -v
v0.6.1-pre
NVM says this (after I install a version of node for the first ...
1517
votes
23
answers
1.3m
views
Where does npm install packages?
Can someone tell me where can I find the Node.js modules, which I installed using npm?
1458
votes
25
answers
1.1m
views
Sending command line arguments to npm script
The scripts portion of my package.json currently looks like this:
"scripts": {
"start": "node ./script.js server"
}
...which means I can run npm start to start the ...
1044
votes
19
answers
773k
views
How to list npm user-installed packages?
How do I list the user-installed / environment package only in npm?
When I do npm -g list, it outputs every package and their dependencies. Instead I'd like to see the packages installed in the ...
1042
votes
16
answers
396k
views
Difference between npx and npm?
I have just started learning React, and Facebook helps in simplifying the initial setup by providing the following ready-made project.
If I have to install the skeleton project I have to type npx ...
679
votes
11
answers
571k
views
Installing a local module using npm?
I have a downloaded module repo, I want to install it locally, not globally in another directory?
What is an easy way to do this?
662
votes
4
answers
118k
views
What is the meaning of the "at" (@) prefix on npm packages?
In the Angular Component Router documentation I just stumbled over a npm command I have never seen before and I don't understand what is going on:
npm install @angular/router --save
What is the ...
534
votes
9
answers
620k
views
What does npm install --legacy-peer-deps do exactly? When is it recommended / What's a potential use case?
Just ran into this error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! ...
532
votes
18
answers
862k
views
Node.js - SyntaxError: Unexpected token import
I don't understand what is wrong.
Node v5.6.0
NPM v3.10.6
The code:
function (exports, require, module, __filename, __dirname) {
import express from 'express'
};
The error:
SyntaxError: ...
433
votes
5
answers
540k
views
Node update a specific package
I want to update my Browser-sync without updating all my node packages. How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(
├─┬ [email protected]
│ ├── ...
414
votes
16
answers
689k
views
npm WARN ... requires a peer of ... but none is installed. You must install peer dependencies yourself
I tried to run a project downloaded from github. Unfortunately, during npm install the following warnings were shown. I tried to change the version based on this question. However, I had a problem, ...
408
votes
46
answers
843k
views
Node.js Port 3000 already in use but it actually isn't?
I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on localhost, port 3000.
Today, I started to ...
302
votes
45
answers
460k
views
Maximum call stack size exceeded on npm install
I'm trying to run npm install, this is output from console:
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ...
283
votes
5
answers
116k
views
What is the bower (and npm) version syntax?
Bower enables me to specify version requirements for packages using the following syntax:
"dependencies": {
"<name>": "<version>",
},
But I have not been able to find what is the ...
277
votes
9
answers
317k
views
After installation of Gulp: “no command 'gulp' found”
After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.
When looking under the node_modules/.bin/ ...
276
votes
18
answers
329k
views
How to Set port in next.js
One application is running on port 3000 and I want to run another application on a different port from the default port, which is 3000. How do I change this in React Next.js? My package.json currently ...
259
votes
17
answers
496k
views
Fix the upstream dependency conflict installing NPM packages
I am trying to npm install vue-mapbox mapbox-gl, and I'm getting a dependency tree error.
I'm running Nuxt.js SSR with Vuetify and haven't installed anything related to Mapbox prior to running this ...
247
votes
10
answers
210k
views
Running NPM scripts sequentially
Let's say I have
"scripts": {
"pre-build": "echo \"Welcome\" && exit 1",
"build_logic": "start cmd.exe @cmd /k \"yo esri-appbuilder-js:widget && exit 1\"",
"post_build": ...
232
votes
7
answers
312k
views
Deleting `package-lock.json` to Resolve Conflicts quickly
In a team set up, usually, I have faced merge conflicts in package-lock.json and my quick fix has always been to delete the file and regenerate it with npm install. I have not seriously thought about ...
225
votes
47
answers
760k
views
npm - EPERM: operation not permitted on Windows
I ran
npm config set prefix /usr/local
After running that command,
When trying to run any npm commands on Windows OS I keep getting the below.
Error: EPERM: operation not permitted, mkdir 'C:\...
214
votes
7
answers
63k
views
When to use Yarn over NPM? What are the differences?
What are the differences between Yarn and NPM?
At the time of writing this question I can only find some articles on the Internet showing what's the Yarn equivalent of an NPM command.
Do they have the ...
213
votes
14
answers
467k
views
"A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received", What does that mean?
I'm working on a React application and I use some npm modules, one of which I had to build myself. (my NPM package:
https://www.npmjs.com/package/modale-react-rm).
It is a simple modal that opens and ...
211
votes
2
answers
125k
views
What is the "module" package.json field for?
I've seen some npm packages (vue for example) have a module field in their package.json.
But module is not included in the package.json documentation - is this a convention of some kind? Is there ...
210
votes
15
answers
297k
views
Yarn global command not working
I'm working with Yarn v0.16.1. If I understand correctly (according to the documentation), yarn global add <package> should be the equivalent of npm install -g <package>. However, when I ...
208
votes
7
answers
543k
views
How to run eslint --fix from npm script
I am trying to add lint-fix in my package.json.
My basic lint is "lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
I did try "lint-fix": "eslint --fix --ext .js,.vue src test/unit/...
206
votes
22
answers
66k
views
Appending .js extension on relative import statements during Typescript compilation (ES6 modules)
This seems to be a trivial problem, but it is not very obvious what settings/configurations need to be used to solve this issue.
Here are the Hello World program directory structure and the source ...
199
votes
1
answer
205k
views
Should the package-lock.json file be added to .gitignore? [duplicate]
To lock the versions of dependencies that are installed over a project, the command npm install creates a file called package-lock.json. This was made since Node.js v8.0.0 and npm v5.0.0, as several ...
192
votes
5
answers
88k
views
Use of @ symbol in Node module names [duplicate]
I'm looking at some code from a coworker wrote and she's using the @ symbol in require statements. This is the first line of one of these files:
var restServer = require('@company/config')
When I ...
186
votes
17
answers
655k
views
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Nuwanst\package.json'
I just want to install socket.io to my project which is located on 3.chat folder. But when I run following command it shows following Warnings.And its not created a node_modules directory inside my ...
179
votes
3
answers
107k
views
What is "entry point" in npm init
I have an empty new project, when i run npm init i got a list of questions to answer, for example:
name: (karma)
version: (1.0.0)
description:my project description
entry point: (index.js)
I am ...
173
votes
14
answers
52k
views
Jest SecurityError: localStorage is not available for opaque origins
When I want to run my project with the command npm run test, I get the error below. What is causing this?
FAIL
● Test suite failed to run
SecurityError: localStorage is not available for opaque ...
169
votes
11
answers
47k
views
How to publish a module written in ES6 to NPM?
I was about to publish a module to NPM, when I thought about rewriting it in ES6, to both future-proof it, and learn ES6. I've used Babel to transpile to ES5, and run tests. But I'm not sure how to ...
164
votes
5
answers
51k
views
JavaScript dependency management: npm vs. bower vs. volo [closed]
How do you compare npm, bower and volo?
All three can be used to install JavaScript dependencies for a UI project.
I understand npm is more node specific.
So, when to use what?
npm still stands ...
163
votes
6
answers
143k
views
`npm build` doesn't run the script named "build" in package.json
For a new module I'm trying to use npm build without gulp / Grunt / other specialised build tools.
"scripts": {
"build": "node build.js"
},
My build.js is simply
console.log('Hello')
However, ...
161
votes
4
answers
74k
views
How do you resolve Git conflicts in yarn.lock
When multiple Git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn.lock file. It is not a good idea to delete and regenerate the yarn.lock ...
157
votes
47
answers
761k
views
"internal/modules/cjs/loader.js:582 throw err"
I'm getting the following error in the console:
Error : Cannot find module.
Here is the full error. What should I do?
internal/modules/cjs/loader.js:582
throw err;
^
Error: Cannot find module ...
153
votes
8
answers
208k
views
Print a list of all installed node.js modules
In a node.js script that I'm working on, I want to print all node.js modules (installed using npm) to the command line. How can I do this?
console.log(__filename);
//now I want to print all ...
146
votes
11
answers
135k
views
React JSX file giving error "Cannot read property 'createElement' of undefined"
I have a file test_stuff.js that I am running with npm test
It pretty much looks like this:
import { assert } from 'assert';
import { MyProvider } from '../src/index';
import { React } from 'react';
...
136
votes
5
answers
251k
views
Local package.json exists, but node_modules missing
I am trying to start a Redux application I just cloned from a GitHub repository.
I tried to run it with the following command
npm start
I am getting this error
> [email protected] start /...
136
votes
2
answers
245k
views
How do you run a js file using npm scripts?
I can't get npm to work. My package.json file has
"scripts": { "build": "build.js" }
and I have a build.js file in the same folder that just console.logs.
When I run
npm run build
I get the ...
129
votes
20
answers
488k
views
Uncaught ReferenceError: process is not defined
I am using node.js to create a web application. When I run the application (either by opening index.html on the browser or using the command "npm start" on the terminal) I get two errors:
...
126
votes
3
answers
63k
views
Do you put Babel and Webpack in devDependencies or Dependencies?
I'm new to npm and don't really understand what should go into dependencies vs. devDependencies. I know that for testing libraries they should go into dev, but how about for things like babel and ...
121
votes
3
answers
154k
views
npm install the exact package version specified in package.json
Currently, If I run npm install, it installs the updated version of already installed packages. How can I install the exact version as specified in the package.json file?
119
votes
26
answers
170k
views
Error: PostCSS plugin tailwindcss requires PostCSS 8
I installed the new tailwindcss version 2.0 and I've got the following error. I tried to uninstall postcss and tailwindcss but it does not work.
error in ./src/components/util/SlideInfo.vue?vue&...
119
votes
26
answers
297k
views
Module not found: Error: Can't resolve 'crypto'
I am getting the following list of errors when I run ng serve.
My package JSON is as follows:
{ "name": "ProName", "version": "0.0.0", "scripts": {
"ng": "ng",
"start": "ng serve",
...
118
votes
3
answers
21k
views
Why do some npm packages start with @? [duplicate]
Is there anything different about the dependencies that start with @?
Does that mean or imply something?
I don't see any info about that. Take a look at my node_modules folder:
Fortawesome starts ...
117
votes
2
answers
144k
views
Node engine 8.x or 10.x in package.json
I tried to specify the node engine in a package.json to accept both 8 and 10 version.
I tried to type this:
"engines": {
"node": "8.x|10.x"
},
But running yarn results in:
The engine "node" is ...
114
votes
18
answers
151k
views
create-react-app: How do I "npm start" with a specific browser?
npm start
starts the react server on the default browser, which is Firefox for me. I like Firefox for browsing but prefer Chrome in web development for its developer tools. Is there a way to force "...
111
votes
6
answers
39k
views
Writing npm modules in TypeScript
I am working on my first npm module. I briefly worked with TypeScript before and a big problem was that for many modules there were no definition files available. So I thought it would be a good idea ...