Skip to content

node_modules directory empty at install time #14

Description

@backlit-studio

I have a module i'm developing that depends on boost and I'm to get this working.

It works fine when i run npm install from the root of the directory itself. But when i actually push the module to github and npm install this module from another project the install script fails because it can't find the boost-lib directory anywhere. These seems to be because the node_modules directory is not available at the time npm runs the install script.

Here is the relevant bit of my CMakeLists.txt:

...
message("Searching In: ${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE boostlib_cmake_path "${CMAKE_CURRENT_SOURCE_DIR}/node_modules" "BoostLib.cmake")
list(GET boostlib_cmake_path 0 boostlib_cmake_path)
get_filename_component(boostlib_cmake_path "${boostlib_cmake_path}" DIRECTORY)
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${boostlib_cmake_path}")
include(BoostLib)
require_boost_libs(">= 1.6.0" system)
...

The package.json of the module itself has the following:

{
// ...
  "scripts": {
    "install": "ls node_modules && cmake-js compile"
  },
  "dependencies": {
    "boost-lib": "^0.11.3",
    "cmake-js": "^3.4.0",
    "nan": "^2.5.1"
  },
}

The error CMake gives when i try to npm install the module from another project:

CMake Error at CMakeLists.txt:22 (list):
  list GET given empty list


CMake Error at CMakeLists.txt:25 (include):
  include could not find load file:

    BoostLib


CMake Error at CMakeLists.txt:26 (require_boost_libs):
  Unknown CMake command "require_boost_libs".

The result of running ls node_modules at the time the module's npm install script gets called:

ls: node_modules: No such file or directory

Not sure where i should be looking for boost-lib if there's no node_modules directory yet. Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions