There is probably an obvious answer to someone who is more familiar with NodeJS than me but:
When running an application which is using a node-gyp package, it runs without problems using node ./src/index.js
However running it using a very simple package.json
start-script:
"scripts": {
"start": "node ./src/index.js"
}
in npm:
npm start
npm info it worked if it ends with ok
npm info using npm@6.9.0
npm info using node@v11.10.1
npm info lifecycle rosbag2@0.1.0~prestart: rosbag2@0.1.0
npm info lifecycle rosbag2@0.1.0~start: rosbag2@0.1.0
> rosbag2@0.1.0 start /Users/andreasklintberg/personal/xviz/examples/converters/rosbag2
> node ./src/index.js "./src/index.js"
internal/modules/cjs/loader.js:779
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: dlopen(/Users/andreasklintberg/personal/xviz/examples/converters/rosbag2/node_modules/rosbags2_nodejs/build/Release/rosbags2_nodejs.node, 1): Library not loaded: @rpath/librosidl_typesupport_cpp.dylib
Referenced from: /Users/andreasklintberg/personal/xviz/examples/converters/rosbag2/node_modules/rosbags2_nodejs/build/Release/rosbags2_nodejs.node
Reason: image not found
And similarly in yarn yarn start
yarn run v1.13.0
warning package.json: No license field
$ node ./src/index.js ./src/index.js -d ../../../data/rosbag2/rosbag2_2019_03_09-21_54_44 -o ../../xviz-data/rosbag2/rosbag2_2019_03_09-21_54_44/
internal/modules/cjs/loader.js:779
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: dlopen(/Users/andreasklintberg/personal/xviz/examples/converters/rosbag2/node_modules/rosbags2_nodejs/build/Release/rosbags2_nodejs.node, 1): Library not loaded: @rpath/librosidl_typesupport_cpp.dylib
Referenced from: /Users/andreasklintberg/personal/xviz/examples/converters/rosbag2/node_modules/rosbags2_nodejs/build/Release/rosbags2_nodejs.node
Reason: image not found
I know the error is because a dynamic link/@rpath is messed up, and I was thinking it was because npm/yarn
messes with the env variables or something, but running yarn env
it seems everything is correct.
So I guess i'm wondering if anyone know what the difference is running it in native node and using npm/yarn
script to wrap the start? And why this difference messes up the @rpath/dynamic linking ?
from Starting application using node works but not yarn or npm
No comments:
Post a Comment