node-modules

SystemJS import chart.js in index.html

狂风中的少年 提交于 2020-01-25 06:23:28
问题 I am new to angularjs (specially angular js2). I am confused with SystemJS importing / configurations. I have my application (angularjs2) which works ok. I am developing it with Visual Studio. I have set up the package.json which loads in node_modules my necessary stuff. In my case I would like to use chart.js snippet from package.json file "dependencies": { "angular2": "2.0.0-beta.15", "es6-shim": "^0.35.0", "reflect-metadata": "0.1.2", "rxjs": "5.0.0-beta.2", "systemjs": "^0.19.26", "zone

Import Issue for React-Table

狂风中的少年 提交于 2020-01-24 20:55:08
问题 I am creating a table in react using react-table library. Few days back, I had created a table using the same library and faced no issues. But today I am getting the following error. Attempted import error: 'react-table' does not contain a default export (imported as 'ReactTable'). Import Statement: import ReactTable from 'react-table'; I created multiple new projects from scratch and installed the node modules. Is there any way to resolve this issue? 回答1: I don't know which version of React

Install node_modules to vendor

▼魔方 西西 提交于 2020-01-24 03:07:29
问题 How can I install npm modules locally for each project to vendor/node_modules and make package.json file see them. I don't want to move package.json to vendor folder I have bower and in .bowerrc I specify the bower_components path - that is super easy. How can I do that with npm ? I`ve read the docs, npmrc docs, some questions here, googled, wasted more than an hour - still no luck. This is ridiculously hard for such an easy task. I don't care about minuses, just tell me how to do that

nodejs: Node modules vs singleton classes

孤者浪人 提交于 2020-01-23 07:29:16
问题 PRE: I've read NodeJS modules vs classes but this is more specific. As part of some refactoring in Node I have a couple of Application Services (in DDD-terminology) which are technically implemented as Node modules. Since (in a DDD-world, an probably any other for that matter) Application Services should be singletons and since Node modules are guaranteed to be 1 'instance' only, it seems to me that this is an okay fit (modules trivially implement the 'singletonness') Is there any reason why

How to specify cache folder in npm5 on install command?

谁都会走 提交于 2020-01-20 08:45:12
问题 In yarn it's possible using yarn --cache-folder [CACHE_FOLDER] , what is npm5 alternative? It's possible to set it with separate command npm config set cache [CACHE_FOLDER] , but I'm curious if it's possible to do with just passing some argument to npm install I've checked v5.0.1 release notes and npm install docs but can't find anything about setting cache folder 回答1: As answered by @maybekatz (npm engineer) on twitter it's possible using --cache argument: npm install --cache [CACHE_FOLDER]

`Cannot find module` for my own TypeScript module

╄→гoц情女王★ 提交于 2020-01-15 05:30:48
问题 I have just published a new TypeScript-based module to the NPM registry, ooafs. However, when I try to install it and import it in another TypeScript project, VSCode gives me the following error on the import statement: Cannot find module 'ooafs'.ts(2307) . This module's source files are compiled to JavaScript to a dist/ folder and definitions ( .d.ts ) are also generated. Here's the tree of the published module (the one we download when we npm install ): . ├── dist │ ├── Entry.d.ts │ ├──

Having project_name/node_modules as a symlink?

若如初见. 提交于 2020-01-14 03:58:32
问题 Related: single node_modules folder for multiple projects If npm install -g everything is not recommended, and I do not want to link individual modules, can I possibly symlink <some project>/node_modules to a common directory to be shared by multiple projects? 回答1: Node can handle the symlinks perfectly fine. How to achieve this is going to depend on some of your objectives. The most important being: what experience do you want to have for other developers who download your project(s) from

NodeJS require all modules in one file, good practice?

元气小坏坏 提交于 2020-01-14 03:50:14
问题 I am wondering if there is any downside, from a design or security point of view, having one file that requires() all the modules that I need, and then exports them. This would save me to keep track of all modules in every single file. Example: // my_requires.js const bodyParser = require('body-parser') const parseForm = bodyParser.urlencoded({extended: false}) const DOMPurify = require('dompurify'); const {JSDOM} = require('jsdom'); const jwt = require('jsonwebtoken'); const passport =

azure emulator not starting for web role if node_modules directory exists

空扰寡人 提交于 2020-01-13 16:18:42
问题 I think I just stumbled on a really weird problem. I have a pretty big solution including one azure project with 3 roles, two worker and one web role. The web role is based on asp.net mvc and web api. After experimenting with gulp yesterday (for compiling and bundling less files), I noticed just now that the azure emulator won't start this role anymore. The emulator start dialog just stops at ~ 80% and stays there forever, without any error messages. After I removed the node_modules directory

Can node modules require each other

心已入冬 提交于 2020-01-12 03:07:40
问题 I'm having the following 3 files. user.js requires room.js and room.js requires user.js. user.js var Room = require('./room.js'); var User = function () {}; User.prototype.test = function () { return new Room(); }; module.exports = User; room.js var User = require('./user.js'); var Room = function () {}; Room.prototype.test = function () { return new User(); }; module.exports = Room; index.js var User = require('./user.js'); var Room = require('./room.js'); var user = new User(); var room =