Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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.
Nafiul Islam's user avatar
  • 81.8k
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 ...
Dominic Tancredi's user avatar
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?
trnc's user avatar
  • 21.3k
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 ...
user avatar
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 ...
lolski's user avatar
  • 17k
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 ...
Paresh Maniyar's user avatar
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?
fancy's user avatar
  • 50.6k
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 ...
jbandi's user avatar
  • 18k
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! ...
antonwilhelm's user avatar
  • 7,028
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: ...
SofDroid's user avatar
  • 5,509
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] │ ├── ...
Samuel's user avatar
  • 5,859
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, ...
user avatar
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 ...
user2573690's user avatar
  • 5,863
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 ...
GROX13's user avatar
  • 4,735
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 ...
Samuel Hapak's user avatar
  • 7,112
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/ ...
AndrewMcLagan's user avatar
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 ...
Sohail Ahmad's user avatar
  • 9,367
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 ...
connorcode's user avatar
  • 2,771
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": ...
Rice's user avatar
  • 3,491
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 ...
John Mutuma's user avatar
  • 3,480
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:\...
Lahar Shah's user avatar
  • 7,444
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 ...
Asha's user avatar
  • 4,101
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 ...
Romin Manogil's user avatar
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 ...
ryanve's user avatar
  • 51.8k
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 ...
jaredsk's user avatar
  • 2,706
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/...
Marek Urbanowicz's user avatar
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 ...
user3330840's user avatar
  • 7,175
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 ...
Francisco Maria Calisto's user avatar
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 ...
Derek Janni's user avatar
  • 2,487
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 ...
user avatar
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 ...
Ahmed Farahat's user avatar
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 ...
amirdehghan's user avatar
  • 1,651
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 ...
Traveling Tech Guy's user avatar
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 ...
Yugal Jindle's user avatar
  • 45.2k
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, ...
mikemaccana's user avatar
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 ...
Christian Schlensker's user avatar
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 ...
istiyak ahamed Milon's user avatar
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 ...
Anderson Green's user avatar
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'; ...
Some Guy's user avatar
  • 13.3k
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 /...
Deepak Mahakale's user avatar
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 ...
Richard's user avatar
  • 16.2k
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: ...
Kantharis's user avatar
  • 1,616
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 ...
stackjlei's user avatar
  • 9,865
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?
suheb's user avatar
  • 1,589
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&...
Niklas Forst's user avatar
  • 1,311
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", ...
Illep's user avatar
  • 16.7k
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 ...
Oscar's user avatar
  • 2,029
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 ...
rap-2-h's user avatar
  • 31.4k
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 "...
Osama Qarem's user avatar
  • 1,449
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 ...
Andreas Gassmann's user avatar

1
2 3 4 5
203