Questions tagged [node-modules]

Node.js has a simple module loading system that reduces complexity of applications and promotes code reusability.

Node.js has a simple module loading system that reduces complexity of applications and promotes code reusability. In Node.js, files and modules are in one-to-one correspondence.

For example, foo.js loads the module circle.js in the same directory:

The contents of foo.js:

var circle = require('./circle.js');
console.log( 'The area of a circle of radius 4 is ' + circle.area(4));

The contents of circle.js:

var PI = Math.PI;

exports.area = function (r) {
  return PI * r * r;
};

exports.circumference = function (r) {
  return 2 * PI * r;
};

Node.js also has an incredible community of open source developers who publish packages using :

6621 questions
2
votes
1 answer

yarn doesn't upgrade package file

When I update my deps with yarn upgrage-interactive, it does update in yarn.lock file (and node_module ofc), but package.json still without updates. How can I update my package.json deps accordingly to latest upgrade packages, which in yarn.lock…
WebArtisan
  • 3,996
  • 10
  • 42
  • 62
2
votes
4 answers

After command npm start "Missing script:start" error

When I typed npm start following error is given ; npm ERR! Linux 4.4.0-109-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! missing script: start npm ERR! npm ERR! If you need help,…
mhendek
  • 273
  • 2
  • 5
  • 16
2
votes
0 answers

My npm globally installed packages don't work

I installed a cute-files npm package globally (it doesn't matter it could be anything else), I expect when I run: cute-files I will see result but now I see cute-files isn't a command. I should tell you I changed my npm directory because of some…
Nima Ra
  • 25
  • 9
2
votes
1 answer

Not able to access googleapis auth.OAuth2 for google calender api

The below code is pasted from node.js quickstart of Google calender Api section.This code is not able to access auth from google API's.I copied the error below.To see full code you can access this link .Thanks for the help. const google =…
Kapil Yadav
  • 780
  • 1
  • 8
  • 15
2
votes
1 answer

Why do I keep getting this Node SyntaxError after a while?

Can anyone help me with this SyntaxError? I keep getting it on various paths not only mongoose, sometimes is bluebird sometimes another module. Tried and deleted the node_modules folder and reinstall the npm modules which fixes the issue but after a…
2
votes
2 answers

Changing code in existing node module

I have vue.js project with element-ui. All installed via npm. Now I want to change something in element-ui just to test if it works so I go in it's folder in node_modules, change code in component, run 'npm run dev' and change is not visible. Is it…
Space Peasant
  • 287
  • 1
  • 3
  • 16
2
votes
1 answer

Webpack 4 cache splitChunks so they are not processed each time

I have a TypeScript project which is using node packages and webpack to compile and bundle. My folder structure is; Scripts App Various Modules Utility Various Utility components and helpers Index.tsx My webpack config…
Tim B James
  • 20,084
  • 4
  • 73
  • 103
2
votes
1 answer

user signup api in nodejs using mongodb

Im creating an api for sign-up with mongodb as backend. this code throws an error like unexpected token (if statement) please check with the logic & also i need to bcrypt my password before saving into db, i never done that before. please help me to…
LogaKrishnan
  • 491
  • 1
  • 9
  • 24
2
votes
1 answer

What does npm uninstall do when no options provided

So, I'm working on a node project where the prior developer gave instructions that if the application is not building correctly to simply run npm uninstall (without any options or parameters) then re-run npm install. So, I understand how npm…
rup
  • 123
  • 1
  • 10
2
votes
1 answer

Creating npm package for both browser and node

I'm trying to create an npm package that could be used by web apps or other node modules. If I were to only support browsers, I would just assign to window window.myExport = myExport; (unless there's a more modern way I'm not aware of?). If I were…
junvar
  • 11,151
  • 2
  • 30
  • 46
2
votes
1 answer

Npm - how to manage one-repo, multi-package codebase

I’m building a node.js app that needs to be scalable and maintainable. The idea is to have one repository, but with more than one module inside it. We are using local modules with npm, but we have a problem is that when we update a modules npm won’t…
Simone Pontiggia
  • 204
  • 2
  • 10
2
votes
1 answer

Module not found: Can't resolve custom package [React Import]

I am trying to create my very first node package, it was successfully publish and live on npmjs.com website but whenever i include it on a sample react project using create-react-app i get this following error Here's how i import it import…
user9383661
2
votes
1 answer

Is it better to use a 128-bit long (uuid) or a 7-bit long (shortid) unique ID generator in Node?

I'm currently using uuid npm package to generate unique IDs for the elements of my graph database in my node.js app. It generates RFC-compliant 128-bit long IDs, like 6e228580-1cb5-11e8-8271-891867c15336 I'm currently thinking to shift to shortid…
Aerodynamika
  • 7,883
  • 16
  • 78
  • 137
2
votes
0 answers

Specify the node modules folder in angular 4 using mklink

Hello i want to change the location of my node_modules folder and after some research i didn't find a way to change it somewhere in angular-cli.json or in any other json. I found this command : mklink /j node_modules S:\somepath\node_modules So…
John
  • 261
  • 2
  • 16
2
votes
1 answer

How to properly design API module in TypeScript?

I want to design a TypeScript (2.7) module for accessing external IS, let's call it InfoSys. I used the following approach. I created info-sys.ts which defines a API class and related interfaces and enums, like: class Api { constructor(private…
1 2 3
99
100