# Playing around with the Admin API in the Node shell/REPL?

**URL:** <https://forum.ghost.org/t/playing-around-with-the-admin-api-in-the-node-shell-repl/11115>\
**Category:** Developer help\
**Created:** [January 2, 2020, 5:37pm UTC](https://forum.ghost.org/t/playing-around-with-the-admin-api-in-the-node-shell-repl/11115 "2020-01-02T17:37:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tillrahn](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/tillrahn/32/4587_2.png) [@tillrahn](https://forum.ghost.org/u/tillrahn)\
**Post date:** [January 2, 2020, 5:37pm UTC](https://forum.ghost.org/t/playing-around-with-the-admin-api-in-the-node-shell-repl/11115/1 "2020-01-02T17:37:22Z")

</div>

Hi,  
I’m just trying to familiarize myself with the Ghost APIs and tried to require the Admin API with  
`const GhostAdminAPI = require('@tryghost/admin-api')`  
in the node shell with running the `node` command in the Ghost directory.  
It throws this error though:  
$ node  
\> const GhostAdminAPI = require(’@tryghost/admin-api’)  
Thrown:  
{ Error: Cannot find module ‘@tryghost/admin-api’  
at Function.Module.\_resolveFilename (internal/modules/cjs/loader.js:636:15)  
at Function.Module.\_load (internal/modules/cjs/loader.js:562:25)  
at Module.require (internal/modules/cjs/loader.js:692:17)  
at require (internal/modules/cjs/helpers.js:25:18) code: ‘MODULE\_NOT\_FOUND’ }

The @tryghost/admin-api is in the respective node\_modules folder.

Can anyone help?

If you’re looking for some help, it’s important to provide as much context as possible so that people are able to assist you. Try to always mention:

- What’s your URL? This is the easiest way for others to debug your issue
- What version of Ghost are you using? 3.2.0
- What configuration?
- What browser?
- What errors or information do you see in the console?
- What steps could someone else take to reproduce the issue you’re having?

---

<div class="post-metadata">

**Author:** ![naz](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/naz/32/30666_2.png) [@naz](https://forum.ghost.org/u/naz)\
**Post date:** [January 6, 2020, 10:41am UTC](https://forum.ghost.org/t/playing-around-with-the-admin-api-in-the-node-shell-repl/11115/2 "2020-01-06T10:41:43Z")

</div>

Hey @tillrahn 👋 To be able to access ‘@tryghost/admin-api’ module from Node REPL you need to run it from the folder that is having `node_models` with this package installed. You can make sure the module is there with:

```auto
➜ tree node_modules/@tryghost/admin-api  
node_modules/@tryghost/admin-api
├── lib
│ ├── index.js
│ └── token.js
├── LICENSE
├── package.json
└── README.md

1 directory, 5 files

```

I just tried this in one of the projects that uses `admin-api` and it worked fine requiring it from the REPL 😉

---

<div class="post-metadata">

**Author:** ![tillrahn](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/tillrahn/32/4587_2.png) [@tillrahn](https://forum.ghost.org/u/tillrahn)\
**Post date:** [January 7, 2020, 12:31pm UTC](https://forum.ghost.org/t/playing-around-with-the-admin-api-in-the-node-shell-repl/11115/3 "2020-01-07T12:31:45Z")

</div>

Thank you, @naz. Made it work. Made a stupid mistake assuming the module was installed in the main Ghost repo, which it wasn’t… 😃
