I've distilled this issue down to a simple test. I'm using the node "config" module to define configuration values for my app. Pkg doesn't complain on build, but barfs at runtime with the following message. Am I missing something?
jim-macbookpro:~/development/node/pkgtest$ ./pkgtest-macos
pkg/prelude/bootstrap.js:1172
throw error;
^
Error: Cannot find module 'config'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Function.Module._resolveFilename (module.js:540:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1269:46)
at Function.Module._load (module.js:470:25)
at Module.require (module.js:583:17)
at Module.require (pkg/prelude/bootstrap.js:1153:31)
at require (internal/module.js:11:18)
at Object.<anonymous> (/snapshot/pkgtest/index.js:1:78)
at Module._compile (pkg/prelude/bootstrap.js:1243:22)
at Object.Module._extensions..js (module.js:650:10)
at Module.load (module.js:558:32)
index.js is simple:
const config = require('config');
console.log('yo:', config.message);
and I have a default.json in the local 'config' directory:
{
"message": "whodapunk?"
}
My package.json, for what it's worth:
{
"name": "pkgtest",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"config": "^1.30.0"
},
"bin": "index.js"
}
BTW, if I change
const config = require('config');
to
const config = require('./node_modules/config');
it works.
Am I not telling pkg how to find node_modules or something like that?
pkg version: 4.3.0
Created index.js, config/default.json and package.json exactly as you specified.
> npm install
> pkg . --target node8-x64-macos
> ./pkgtest
yo: whodapunk?
Seems to work for me.
Can you double check that npm install is run prior to compilation, and show me pkg version you're using pkg --version.
Double-checked.
(sound of head banging on desk)
jim-macbookpro:~/development/node/pkgtest$ npm install
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
up to date in 0.217s
jim-macbookpro:~/development/node/pkgtest$ pkg --version
4.3.1
jim-macbookpro:~/development/node/pkgtest$ pkg . --target node8-x64-macos
> [email protected]
jim-macbookpro:~/development/node/pkgtest$ ./pkgtest
pkg/prelude/bootstrap.js:1172
throw error;
^
Error: Cannot find module 'config'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Function.Module._resolveFilename (module.js:534:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1269:46)
at Function.Module._load (module.js:464:25)
at Module.require (module.js:577:17)
at Module.require (pkg/prelude/bootstrap.js:1153:31)
at require (internal/module.js:11:18)
at Object.<anonymous> (/snapshot/pkgtest/index.js:1:78)
at Module._compile (pkg/prelude/bootstrap.js:1243:22)
at Object.Module._extensions..js (module.js:644:10)
at Module.load (module.js:552:32)
jim-macbookpro:~/development/node/pkgtest$ node index.js
config: whodapunk?
yo: {
"message": "whodapunk?"
}
jim-macbookpro:~/development/node/pkgtest$
This is really strange. I'm still not seeing the issue. I updated to pkg 4.3.1. I'm on an MBP with High Sierra (I assume you are too). So we essentially have very similar environments, yet your build fails, while mine does not.
I'm sorry, I can't help you past this. The original package authors don't appear to respond around here much either.
The only difference I see is that I'm using the latest stable node (9.11.1), but I don't see how that would explain it.
For now I have a workaround, but it feels like there's a bug down there somewhere.
Please keep in mind that node uses even/odd versioning scheme where even numbers are stable long-term support (LTS) releases, while odd ones are feature-driven not-so-stable releases. So if you plan to use this for production, I'd recommend sticking with node v8.
Guys i believe i'm having the same exact issue...
pkg v4.3.1
node v8.9.4
any ideas?
I've given into my workaround for now:
const config = require('./node_modules/config');
Everything else seems to work fine, so this feels like something related to how requires are handled.
One thing that I don't like so much: to make this work I have to have the config directory deployed along with the executable, when I'd rather have it be bundled in the snapshot filesystem. node-config doesn't anticipate this, so I'm not surprised I don't have control over it.
I wonder if it's an issue with the version of config I'm using....
I'm facing the same problem, also the workaround doesn't work for me:
pkg/prelude/bootstrap.js:1176
throw error;
^
Error: Cannot find module './node_modules/config'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Function.Module._resolveFilename (module.js:545:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1278:46)
at Function.Module._load (module.js:472:25)
at Module.require (module.js:594:17)
at Module.require (pkg/prelude/bootstrap.js:1157:31)
at require (internal/module.js:11:18)
at Object.<anonymous> (/snapshot/microlink-api/src/constant.js:0:0)
at Module._compile (pkg/prelude/bootstrap.js:1252:22)
at Object.Module._extensions..js (module.js:661:10)
at Module.load (module.js:563:32)
I'm using the latest version of pkg and config 馃
Is './node_modules/config' the correct path to config from that module?
The problem happens for every version of node > 8
I was able to workaround this issue by including the config directory in the "assets" list of my package.json:
"pkg": {
"assets": [
"node_modules/config/**/*.*"
]
}
including in "scripts" didn't work.
Note that with the --debug flag specified the config package did generate some warnings about Dynamic compilation failing, because the node-config library has a number of optional dependencies that it programattically requires. I wouldn't expect that to cause the entire library to fail, however...
Stil a problem. I am using this with swagger-expresss-mw and swagger-node-runner.
Adding config to assets like @lselden said solved it. Thanks
I'm also hitting the same issue.
Using @lselden trick did not work around the problem, I had to execute pkg with version 8.15.1 of NodeJS to fix the issue (I was previously using NodeJS 10.15.2).
help !!!!
I'm not using node-config anymore, but one wonky workaround suggestion - you could try using the require(path.join(__dirname)) trick, something like:
// warning, I haven't actually tested this
const forLoadPaths = [
require(path.join(__dirname, 'node_modules/config/lib/config.js'),
require(path.join(__dirname, 'node_modules/json5/lib/index.js')
//... any other paths that didn't get picked up
];
using the --debug flag may help find which files are failing.
I can confirm the problem too on Windows OS.
Node version: v10.15.3 win-x64
If I launch the command with "--debug", I can see it ignores the "node_modules" directory and the "config" library inside it.
`PS C:\tmp\test> pkg .index.js -o index.exe --debug
[email protected]
Targets not specified. Assuming:
node10-win-x64
[debug] Bytecode of %1 is added to queue
C:\tmp\testindex.js
[debug] Stat info of %1 is added to queue
C:\tmp\testindex.js
[debug] Directory %1 is added to queue
C:\tmp\test
[debug] Stat info of %1 is added to queue
C:\tmp\test
[debug] Directory %1 is added to queue
C:\tmp
[debug] Stat info of %1 is added to queue
C:\tmp
[debug] Directory %1 is added to queue
C:\
[debug] Stat info of %1 is added to queue
C:\
[debug] The file was included as bytecode (no sources)
C:\tmp\testindex.js
[debug] The directory files list was included (1 item)
C:\tmp\test
[debug] The directory files list was included (1 item)
C:\tmp
[debug] Targets:
[
{
"nodeRange": "node10",
"platform": "win",
"arch": "x64",
"output": "C:\tmp\test\index.exe",
"forceBuild": false,
"fabricator": {
"nodeRange": "node10",
"platform": "win",
"arch": "x64",
"forceBuild": false,
"binaryPath": "C:\Users\Riccardo\.pkg-cache\v2.5\fetched-v10.4.1-win-x64"
},
"binaryPath": "C:\Users\Riccardo\.pkg-cache\v2.5\fetched-v10.4.1-win-x64"
}
]`
The same project on old Ubuntu distro gives different debug informations (and navigates the node_modules directory)
`kingrial:~/workspace $ pkg index.js -o index.exe --debug
[email protected]
Targets not specified. Assuming:
node6-linux-x64
Fetching base Node.js binaries to PKG_CACHE_PATH
fetched-v6.11.5-linux-x64 [====================] 100%
[debug] Bytecode of %1 is added to queue
/home/ubuntu/workspace/index.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/index.js
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/config/package.json
/home/ubuntu/workspace/index.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/config/lib/config.js
/home/ubuntu/workspace/index.js
[debug] Directory %1 is added to queue
/home/ubuntu/workspace
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/package.json
/home/ubuntu/workspace/node_modules/config/package.json
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/index.js
/home/ubuntu/workspace/node_modules/config/package.json
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Cannot resolve 'fullFilename'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'fullFilename'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'fullFilename'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'JS_YAML_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'JSON5_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'ICED_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'HJSON_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'TS_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'JSON5_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'TOML_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'YAML_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'CSON_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'COFFEE_2_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'PPARSER_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'COFFEE_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Cannot resolve 'XML_DEP'
/home/ubuntu/workspace/node_modules/config/lib/config.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/config/defer.js
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/config/defer.js
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/config/raw.js
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/config
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/cli.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/index.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/register.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/require.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/util.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/dist/index.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Content of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/minimist/package.json
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/minimist/index.js
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/config/lib
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/defer.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/defer.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/raw.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/raw.js
[debug] Directory %1 is added to queue
/home/ubuntu
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/cli.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/register.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/require.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/util.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/dist/index.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist/package.json
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist/index.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist/index.js
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/util.js
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/util.js
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/config
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/defer.js
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/config
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/config/raw.js
[debug] Stat info of %1 is added to queue
/home/ubuntu
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/dist
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist/index.js
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/util.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/util.js
[debug] Bytecode of %1 is added to queue. It was required from %2
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
/home/ubuntu/workspace/node_modules/json5/lib/util.js
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/config
[debug] Directory %1 is added to queue
/home
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/dist
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/minimist
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5
[debug] Stat info of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
[debug] Content of %1 is added to queue
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
[debug] Stat info of %1 is added to queue
/home
[debug] Directory %1 is added to queue
/home/ubuntu/workspace
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules/json5
[debug] Directory %1 is added to queue
/home/ubuntu/workspace/node_modules
[debug] Directory %1 is added to queue
/
[debug] Stat info of %1 is added to queue
/
[debug] The file was included as bytecode (no sources)
/home/ubuntu/workspace/index.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/config/package.json
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/config/lib/config.js
[debug] The directory files list was included (2 items)
/home/ubuntu/workspace
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/package.json
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/index.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/config/defer.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/config/raw.js
[debug] The directory files list was included (4 items)
/home/ubuntu/workspace/node_modules/config
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/cli.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/parse.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/register.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/require.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/stringify.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/unicode.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/lib/util.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/json5/dist/index.js
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/minimist/package.json
[debug] The file was included as DISCLOSED code (with sources)
/home/ubuntu/workspace/node_modules/minimist/index.js
[debug] The directory files list was included (1 item)
/home/ubuntu/workspace/node_modules/config/lib
[debug] The directory files list was included (1 item)
/home/ubuntu
[debug] The directory files list was included (3 items)
/home/ubuntu/workspace/node_modules/json5
[debug] The directory files list was included (8 items)
/home/ubuntu/workspace/node_modules/json5/lib
[debug] The directory files list was included (3 items)
/home/ubuntu/workspace/node_modules
[debug] The directory files list was included (1 item)
/home/ubuntu/workspace/node_modules/json5/dist
[debug] The directory files list was included (2 items)
/home/ubuntu/workspace/node_modules/minimist
[debug] Targets:
[
{
"nodeRange": "node6",
"platform": "linux",
"arch": "x64",
"output": "/home/ubuntu/workspace/index.exe",
"forceBuild": false,
"fabricator": {
"nodeRange": "node6",
"platform": "linux",
"arch": "x64",
"forceBuild": false,
"binaryPath": "/home/ubuntu/.pkg-cache/v2.5/fetched-v6.11.5-linux-x64"
},
"binaryPath": "/home/ubuntu/.pkg-cache/v2.5/fetched-v6.11.5-linux-x64"
}
]`
I'm seeing the same issue with config, but also with the mod package.
Currently running into this issue via the @feathersjs/configuration module, which uses node-config internally. >.>
Seems to be related to this issue https://github.com/zeit/pkg/issues/757
iam facing such type of error any one help me plz
Error: Cannot find module './config/db.config'
Require stack:
TypeError: Cannot read property '__nodemonRestart' of null
at Socket.
at Socket.emit (events.js:210:5)
at addChunk (_stream_readable.js:326:12)
at readableAddChunk (_stream_readable.js:301:11)
at Socket.Readable.push (_stream_readable.js:235:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:182:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: nodemon server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\InFiNiTyAppData\Roamingnpm-cache_logs2019-11-28T08_09_28_289Z-debug.log
The config module is the file,
file with this name "config" is not preset in your recently dowloaded project or if you are using plugin/package the file "config" may look like this I am giving you the random access config of Twitter/Youtube api package example
module.exports = {
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
}
It may also be present in node_modules too..
If you are having the Error: Cannot find module 'config' this means the file is not present in the current directory of the project
var configuration = require('/config'); Or
var configuration = require('config'); Or
var configuration = require('..node_modules/config');
If the module or file 'config' is not present anywhere please create one with appropriate code required anywhere appropriate you feel to create and then root it using ../ or ..
I hope this helps best to the best of informative answer
PS: please use .js as an extension when you create config file
Most helpful comment
I was able to workaround this issue by including the config directory in the "assets" list of my package.json:
including in "scripts" didn't work.
Note that with the --debug flag specified the config package did generate some warnings about Dynamic compilation failing, because the node-config library has a number of optional dependencies that it programattically requires. I wouldn't expect that to cause the entire library to fail, however...