Slimerjs Cannot resolve required module, works with phantomjs

I am trying to create a testing script so that testers can capture some tests using standalone slimerjs 0.9.3. However, when I try to install a local package that I installed (in this case minimal) through npm, I get an error message.

File structure:

clibrowsers/ /osx/slimer/slimerjs /scripts /batchprinter.js /node_modules/minimist/ ... 

When I run "clibrowsers / osx / slimer / slimerjs clibrowsers / scripts / batchprinter.js", I get an error:

 Script Error: Module: Can not resolve "minimist" module required by main located at file:///Users/USER/Documents/dev/clibrowsers/scripts/batchprinter.js Stack: -> file:///Users/USER/Documents/dev/clibrowsers/scripts/batchprinter.js: 351 

When I run the script using phantomjs 2.0.0 (development), I get no errors.

What am I doing wrong?

+5
source share
1 answer

slimer cannot find node_modules on its own, but you can load the module manually, for example: var uuid = require(fs.workingDirectory+'/node_modules/node-uuid/uuid.js');

see doc required for slimerjs

+2
source

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


All Articles