How to import npm module with limited name installed from github?

I am trying to install a github project fork with npm (on master, and not on any specific commit, since I want to develop against it):

% npm install parkan/graffiti-mongoose
@risingstack/graffiti-mongoose@2.0.0 node_modules/@risingstack/graffiti-mongoose

This seems to be looking for the parent repo and setting it to master on my gh, as far as it is good. Note that the package uses the semantics of the semantic sample of the package , which, it seems to me, is part of the 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, I cannot get node to import or require it in any obvious way:

> require('graffiti-mongoose');
Error: Cannot find module 'graffiti-mongoose'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at repl:3:1
    at Object.exports.runInThisContext (vm.js:54:17)
    at _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26)
    at REPLServer.replEval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14)
    at bound (domain.js:250:14)
    at REPLServer.runBound [as eval] (domain.js:263:12)
> require('@risingstack/graffiti-mongoose');
Error: Cannot find module '@risingstack/graffiti-mongoose'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at repl:3:1
    at Object.exports.runInThisContext (vm.js:54:17)
    at _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26)
    at REPLServer.replEval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14)
    at bound (domain.js:250:14)
    at REPLServer.runBound [as eval] (domain.js:263:12)
> require('risingstack/graffiti-mongoose');
Error: Cannot find module 'risingstack/graffiti-mongoose'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at repl:3:1
    at Object.exports.runInThisContext (vm.js:54:17)
    at _eval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:86:26)
    at REPLServer.replEval (/usr/local/lib/node_modules/babel/lib/_babel-node.js:169:14)
    at bound (domain.js:250:14)
    at REPLServer.runBound [as eval] (domain.js:263:12)

How do I get a package that is inside such a subdirectory?

+4
source share
2 answers
+1

package.json:

    "some_github_package": "git+https://github.com/user_name/package_name.git",

npm install

0

Source: https://habr.com/ru/post/1609662/


All Articles