node.js - How to import npm module with scoped name installed from github? -
i'm trying install fork of github project npm (at master rather specific commit since want develop against it):
% npm install parkan/graffiti-mongoose @risingstack/graffiti-mongoose@2.0.0 node_modules/@risingstack/graffiti-mongoose this appears parent repo , install versioned against master on gh, far good. note package uses scoped package name semantics, think part of problem.
% npm list |grep mongoose ├── @risingstack/graffiti-mongoose@2.0.0 (git://github.com/parkan/graffiti-mongoose.git#01a8480fa7d787a4d74bf3bcb257d01b4d73129a) % ls node_modules/@risingstack/graffiti-mongoose changelog.md license fixture contributing.md readme.md package.json however, can't node import or require in obvious way:
> require('graffiti-mongoose'); error: cannot find module 'graffiti-mongoose' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:286:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ repl:3:1 @ object.exports.runinthiscontext (vm.js:54:17) @ _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26) @ replserver.repleval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14) @ bound (domain.js:250:14) @ replserver.runbound [as eval] (domain.js:263:12) > require('@risingstack/graffiti-mongoose'); error: cannot find module '@risingstack/graffiti-mongoose' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:286:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ repl:3:1 @ object.exports.runinthiscontext (vm.js:54:17) @ _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26) @ replserver.repleval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14) @ bound (domain.js:250:14) @ replserver.runbound [as eval] (domain.js:263:12) > require('risingstack/graffiti-mongoose'); error: cannot find module 'risingstack/graffiti-mongoose' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:286:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ repl:3:1 @ object.exports.runinthiscontext (vm.js:54:17) @ _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26) @ replserver.repleval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14) @ bound (domain.js:250:14) @ replserver.runbound [as eval] (domain.js:263:12) how require package that's inside subdirectory this?
this appears bug in npm. checking out repo , installing local filesystem works fine.
issue filed: https://github.com/npm/npm/issues/9798
edit: appears limitation of installing github in cases artifacts aren't checked in , prepublish script must run before module usable, see https://github.com/npm/npm/issues/3055
Comments
Post a Comment