node-modules

Importing Sass through npm

半腔热情 提交于 2019-11-30 01:20:00
Currently in our Sass files we have something like the following: @import "../../node_modules/some-module/sass/app"; This is bad, because we're not actually sure of the path: it could be ../node_modules , it could be ../../../../../node_modules , because of how npm installs stuff. Is there a way in Sass that we can search up until we find node_modules? Or even a proper way of including Sass through npm? ProllyGeek If you are looking for a handy answer in 2017 and are using Webpack, this was the easiest I found. Suppose your module path is like: node_modules/some-module/sass/app Then in your

events.js:160 throw er; // Unhandled 'error' event

江枫思渺然 提交于 2019-11-29 21:28:22
The project I worked on was built with gulp. Recently I updated the node version to v6.3.1. Then something came wrong. A task named 'html' throws an error. Here is the part of error code of it. bogon:toClient work$ gulp html (node:2519) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version. [10:26:10] Using gulpfile ~/Project/TIME_Cancer_Treatment_Centers_of_America(CTCA)/toClient/gulpfile.js [10:26:10] Starting 'html'... (node:2519) fs: re-evaluating native module sources is not supported. If you are using

Npm install failed with “cannot run in wd”

北慕城南 提交于 2019-11-29 19:38:35
I am trying to get my node environment set up on a new Ubuntu 12.04 instance, with Node 0.8.14 already installed, but I ran into problems when I try to run npm install . So when I try npm install , it says that I need to run it as root or adminisrator: Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script' npm ERR! { [Error: EACCES, mkdir '/usr/local/lib/node_modules/coffee-script'] npm ERR! errno: 3, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/coffee-script', npm ERR! fstream_type: 'Directory', npm ERR! fstream_path: '/usr/local/lib/node_modules/coffee

How to modify a MP3 metadata and save by Node.js? [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-29 17:26:58
问题 I want to achieve below goals: Read a MP3 metadata Modify the encoding of that metadata (if I could modify the content of that metadata, that would be better) Save the modification to that MP3 file All these operations could be based on native Node.js (without browser). Is there any module provide such function or I can develop based on? 回答1: For those coming to this question through Google, there is a node module that can do this, both read and write metadata: https://www.npmjs.org/package

Can you export multiple classes from a single Nodejs Module?

无人久伴 提交于 2019-11-29 10:42:03
问题 Currently, I have 4 Child Classes each in their own file. I'm requiring them all in the same file. I am wondering if I can contain all 4 of those classes in a single module. Currently, I'm importing them like this var Jack = require('./Jack.js'); var JackInstance = new Jack(); var Jones = require('./Jones.js'); var JonesInstance = new Jones(); I'd like to import them like this var People = require('./People.js'); var JackInstance = new People.Jack(); Or even var Jack = require('./People.js')

How to pass a command line argument to a nested script?

a 夏天 提交于 2019-11-29 08:37:56
NOTE: This is NOT about sending args to the top-level script, but to the script called by that script In my package.json, when I call a script that takes command line args directly, it works. But when I call a script that calls that other script, it's not passing the command line args to it. How do i pass them? { ... "takes-args": "somemodule", "calls-takes-args": "npm run takes-args" } When i run the below command, the args come through: npm run takes-args -- -env dev But when I run it through the other script, it never gets the args. Is there some way to pass them down? Maybe by a variable

Nodejs Cannot find module

假装没事ソ 提交于 2019-11-29 06:03:58
问题 I'm getting an error when trying to use any global module, exemple: Error: Cannot find module 'express' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:362:17) at require (module.js:378:17) at Object.<anonymous> (C:\BitNami\wappstack\...\test\app.js) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12

Is providing a Promise as a module's export a valid pattern for asynch initialization in Node.js?

久未见 提交于 2019-11-29 01:47:13
问题 I need to write some modules that load data one time and then provide an interface to that data. I'd like to load the data asynchronously. My application already uses promises. Is providing a promise as the result of requiring a module a valid pattern/idiom? Example Module: var DB = require('promise-based-db-module'); module.exports = DB.fetch('foo') .then(function(foo){ return { getId: function(){return foo.id;}, getName: function(){return foo.name;} }; }); Example Usage: require('.

What is the use of module.parent in node.js? How can I refer to the require()ing module?

岁酱吖の 提交于 2019-11-29 01:33:24
问题 I was looking in the node.js module documentation, and noticed that each module has a property- module.parent . I tried to use it, but got burnt by the module caching- module.parent only ever seems to the module that first require()'d it , irrespective of current context. So what is the usage of it? Is there any other way for me to get a reference to the current require()ing module? Right now I'm wrapping the module in a function, so that it is called like: require("mylibrary")(module) but

npm install doesn't create node_modules directory

坚强是说给别人听的谎言 提交于 2019-11-28 22:24:43
I am trying to do a homework for a mongodb uni course. They gave us some files, instructions are: run npm install mongodb then node app.js for some reason npm install does not create a node_modules directory but I don't see any build errors: mongo-uni/hw1-2$ npm install mongodb npm WARN package.json path@0.4.9 path is also the name of a node core module. npm http GET https://registry.npmjs.org/mongodb npm http 304 https://registry.npmjs.org/mongodb npm http GET https://registry.npmjs.org/bson/0.2.5 npm http GET https://registry.npmjs.org/kerberos/0.0.3 npm http 304 https://registry.npmjs.org