I am trying to create a testing script so that the testers can capture some tests using standalone slimerjs 0.9.3. However when I try to require a local package that I installed(minimist in this case) via npm I get an error.
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 the 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 run the script with with phantomjs 2.0.0 (development) I do not get any errors.
What am I doing wrong?
slimer cannot find the node_modules on its own, but you can load the module manually, for instance:
var uuid = require(fs.workingDirectory+'/node_modules/node-uuid/uuid.js');
来源:https://stackoverflow.com/questions/26496004/slimerjs-can-not-resolve-required-module-works-with-phantomjs