node-addon-api cannot be located during npm install

Open
#80 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, node.js
Domain
build-system

Research direction

Reproduce the failure from the hello world example's node-addon-api directory with npm install and node -p "require('node-addon-api').include"; inspect the binding.gyp reference and compare it with the working napi directory. Done means the dependency resolves during installation and the example can build successfully.

Written by the indexing model from the issue text.

Description

I am having a very strange bug. I am inside the node-addon-api dir of the hello world example and when I try to follow the instructions, I get a failure after command:
npm install

essentially it complains that it cannot find node-addon-api when the fline:
node -p "require('node-addon-api').include"
is executed to get the include dir for the binding.gyp file.

I am including the whole log for reference.

I have no idea why it's not able to find the module, sinc this error persists even when I insttall it directly:
npm install node-addon-api

I tried building the n-api dir and it worked no problem:
#inside napi dir
npm install
node-gyp rebuild
node ./
2019-01-12T19_08_43_417Z-debug.log

Dominant language
C++
Stars
2.6k
Forks
602
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nodejs/node-addon-examples

All issues in nodejs/node-addon-examples

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.