Directory was not included into executable at compilation stage
See original GitHub issueTrying to work with the oauth2orize package. Running into some problems specifically here.
Here’s the full error output:
D:\snapshot\Code\temp\pkg-oauth2orize\node_modules\oauth2orize\lib\index.js:39
fs.readdirSync(__dirname + '/grant').forEach(function(filename) {
^
Error: Directory 'D:\Code\temp\pkg-oauth2orize\node_modules\oauth2orize\lib\grant' was not included into executable at compilation stage. Please recompile adding it as asset or script.
at error_ENOENT (evalmachine.<anonymous>:0:0)
at readdirFromSnapshot (evalmachine.<anonymous>:0:0)
at Object.fs.readdirSync (evalmachine.<anonymous>:0:0)
at Object.<anonymous> (D:\snapshot\Code\temp\pkg-oauth2orize\node_modules\oauth2orize\lib\index.js:39:4)
at Module._compile (module.js:571:32)
at Module._compile (evalmachine.<anonymous>:0:0)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
I’ve tried adding every combination / variation of globs I could think of which would point to the node_modules/oauth2orize/lib/grant directory (windows slashes, recursive from a higher folder, full paths instead of relative, including the files inside that folder directly, grabbing the entirety of node_modules/**/*, etc), but I haven’t found the right combination yet. Moving it out of node_modules and into a local libs folder didn’t help, either (but I didn’t really expect that to work).
Is my pkg property in package.json misconfigured, or is it something else?
Can reproduce by sending the following through pkg:
// package.json
{
"name": "pkg-oauth2orize",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"oauth2orize": "^1.8.0"
},
"pkg": {
"scripts": [
// obviously way too many entries here,
// just wanted to show a few of the things i tried,
// some as a group, some separately
"node_modules/oauth2orize/**/*.js",
"node_modules/oauth2orize/lib/grant",
"node_modules/oauth2orize/lib/grant/",
"node_modules/oauth2orize/lib/grant/*",
"node_modules/oauth2orize/lib/grant/*.js",
"node_modules/oauth2orize/lib/grant/**/*.js",
"node_modules/oauth2orize/lib/grant/code.js",
"node_modules/oauth2orize/lib/grant/token.js"
]
}
}
// index.js
require('oauth2orize');
If I go in and re-write the oauth2orize code to do the following instead, it works fine (but I’d like to avoid this, if at all possible):
exports.grant = {};
exports.grant.__defineGetter__('code', function() {
return require('./grant/code');
});
exports.grant.__defineGetter__('token', function() {
return require('./grant/token');
});
// alias grants
exports.grant.authorizationCode = exports.grant.code;
exports.grant.implicit = exports.grant.token;
exports.exchange = {};
exports.exchange.__defineGetter__('authorizationCode', function() {
return require('./exchange/authorizationCode');
});
exports.exchange.__defineGetter__('clientCredentials', function() {
return require('./exchange/clientCredentials');
});
exports.exchange.__defineGetter__('password', function() {
return require('./exchange/password');
});
exports.exchange.__defineGetter__('refreshToken', function() {
return require('./exchange/refreshToken');
});
// alias exchanges
exports.exchange.code = exports.exchange.authorizationCode;
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (1 by maintainers)
Top Related StackOverflow Question
Hi Can you add support for “soap” as well. Getting the following error
Added support for
oauth2orize. Please try again withpkg@4.1.1.