435 questions
713
votes
33
answers
1.9m
views
SyntaxError: Cannot use import statement outside a module
I've got an ApolloServer project that's giving me trouble, so I thought I might update it and ran into issues when using the latest Babel. My "index.js" is:
require('dotenv').config()
import ...
1127
votes
42
answers
1.9m
views
Could not find a declaration file for module 'module-name'. '/path/to/module-name.js' implicitly has an 'any' type
I read how TypeScript module resolution works.
I have the following repository: @ts-stack/di.
After compiling the directory structure is as follows:
├── dist
│ ├── annotations.d.ts
│ ├── ...
1251
votes
24
answers
905k
views
How to install an npm package from GitHub directly
Trying to install modules from GitHub results in this error:
ENOENT error on package.json.
Easily reproduced using express:
npm install https://github.com/visionmedia/express throws error.
npm ...
53
votes
2
answers
112k
views
What is the purpose of the 'node_modules' folder?
What exactly is the node_modules folder and what is it for?
I know when we download any library with npm, the library goes to folder node_modules. I also know that, when we are going to upload it (to ...
2254
votes
68
answers
2.7m
views
How can I update Node.js and npm to their latest versions?
I just installed Node.js and npm. I installed npm for access to additional Node.js modules. After I installed Node.js and npm, I noticed that neither were the latest versions available.
So my ...
762
votes
26
answers
520k
views
How to use executables from a package installed locally in node_modules?
How do I use a local version of a module in Node.js? For example, in my app, I installed coffee-script:
npm install coffee-script
This installs it in ./node_modules and the coffee command is in ./...
167
votes
6
answers
820k
views
Javascript require() function giving ReferenceError: require is not defined
Basically, I am using javascript to scrape data from Google Play store using:
1-Request
2-Cheerios
3-QueryString
I used Google Market API from Github which uses require as following:
var request = ...
262
votes
6
answers
537k
views
npm: When to use `--force` and `--legacy-peer-deps`
I'm trying to understand how recreating the node_modules directory for deployment works.
We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it ...
418
votes
21
answers
564k
views
How can I use paths in tsconfig.json?
I was reading about path-mapping in file tsconfig.json, and I wanted to use it to avoid using the following ugly paths:
The project organization is a bit weird because we have a mono-repository that ...
140
votes
17
answers
100k
views
NPM modules won't install globally without sudo
I have just reinstalled Ubuntu 12.04 LTS, and before anything else i did these steps:
Installed Node via package manager with the following script
sudo apt-get update
sudo apt-get install python-...
235
votes
29
answers
318k
views
Node - was compiled against a different Node.js version using NODE_MODULE_VERSION 51
I am running a node application on terminal. Have recently upgraded to node v8.5.0, but am getting this error:
Error: The module '/tidee/tidee-au/packages/tidee-au-server/node_modules/bcrypt/lib/...
228
votes
23
answers
86k
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 ...
364
votes
12
answers
281k
views
How to include scripts located inside the node_modules folder?
I have a question concerning best practice for including node_modules into a HTML website.
Imagine I have Bootstrap inside my node_modules folder. Now for the production version of the website, how ...
695
votes
12
answers
1.2m
views
Git - Ignore node_modules folder everywhere
I have a project containing multiple other projects :
Main project
Mini project 1
Mini project 2
All containing node_modules folder. I want git to ignore the folder no matter where it is starting ...
373
votes
22
answers
406k
views
Cannot install NodeJs: /usr/bin/env: node: No such file or directory
I'm trying to install nodeJs into my Ubuntu 14.04 in order to use GruntJs.
I've read about Ubuntu different way of doing it (issues?), so this is what I've done in order to install it:
sudo apt-get ...