Closed wenjunche closed 8 years ago
Which are the resources of your machine? This might be due to limited memory. Also, try upgrading node to +4.0 if you can.
Thank you for the quick response.
I checked system config (memory, open files, etc) and don't think it is a resource issue. Also, it works fine with RHEL 7 on the same hardware.
It looks like it is related to command-line-args module (https://github.com/75lb/command-line-args). When It is included as a dependencies in package.json, nar hangs. I can reproduce with following simple example:
{
"name": "simple",
"description": "Simple",
"version": "1.0.0",
"private": true,
"main": "main.js",
"scripts": {
"start": "node ./main.js"
},
"archive": {
"dependencies": true,
"devDependencies": false,
"patterns": ["**"],
"binary": true,
"ignoreFiles": true
},
"dependencies": {
"command-line-args": "^2.1.0"
}
}
Thanks
@wenjunche Thanks for the diagnostic.
The bug is due to a cyclic dependency in nested dependencies of that package. The algorithm to recursively resolve nested dependencies is not handling properly that case where the same dependency and version are used from multiple root or nested packages in the dependency tree.
This only happen in latest npm
versions where the npm
instalation algorithm has changed, thus the algorithm now flatten the dependencies in the root folder to avoid inncessary redundancy, but this increases the package resolution complexibility and dependency analysis timing.
I'll try to fix this today.
This should be fixed in nar@0.3.28
.
It was actually an issue of resolve-tree like I initially supposed.
Update nar
and try it again:
npm update -g nar
Thank you for the update. Now I am getting:
nar create --executable --verbose
Generating executable... path.js:439 throw new TypeError('Arguments to path.resolve must be strings'); ^ TypeError: Arguments to path.resolve must be strings at Object.posix.resolve (path.js:439:13) at posix.relative (path.js:506:14) at /usr/lib/node_modules/nar/lib/create-exec.js:158:18 at Array.map (native) at /usr/lib/node_modules/nar/lib/create-exec.js:157:12 at /usr/lib/node_modules/nar/node_modules/fw/lib/parallel.js:30:62 at /usr/lib/node_modules/nar/node_modules/fw/lib/util.js:40:35 at /usr/lib/node_modules/nar/node_modules/fw/lib/util.js:41:19 at /usr/lib/node_modules/nar/node_modules/resolve-tree/index.js:102:5 at /usr/lib/node_modules/nar/node_modules/fw/lib/parallel.js:30:62
Can't reproduce that. Are you sure you're using the latest version?
Got it. Will take a look.
nar --version 0.3.28
looks like in line 158 of /usr/lib/node_modules/nar/lib/create-exec.js, 'it' in the call to relative is undefined
Update nar
and try again: npm update -g nar
it works great now
Thank you so much for the quick help
Cool. Thank you for reporting the issue. Closing.
FYI I reproduced another issue which was indirectly related to this.
It was fixed too in nar@0.3.30
. Feel free to upgrade.
Hello
I am having an issue with running "nar create --executable" on Red Hat Enterprise Linux Server release 6.5 (Santiago). It just shows: Creating archive...
and never returns. I can see CPU is running at 90%. I am using node v0.12.9 and nar v0.3.27.
Thank you