Skip to content

Symlinks are invalid after moving node_modules #6865

@jeanbmar

Description

@jeanbmar

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Amazon Linux 2
  • TensorFlow.js installed from (npm or script link): "@tensorflow/tfjs-node": "^3.20.0"
  • TensorFlow.js version: "@tensorflow/tfjs-node": "^3.20.0"
  • CUDA/cuDNN version: not appicable

Describe the problem

Symlinks seem to use an absolute path:

try {
await symlink(
path.relative(
path.dirname(destLibTensorFlowPath), depsLibTensorFlowPath),
destLibTensorFlowPath);

I'm talking about the path parameter of fs.symlink, which is destLibTensorFlowPath here.
Using an absolute path prevents moving the node_modules folder, e.g. when packaging deployable archives for cloud use.
For instance and as an additional reference, npm copy will break tfjs-node when it lands in main.

Attempting to run tfjs will throw libtensorflow.so.2: cannot open shared object file: No such file or directory.
I have checked the symlinks and they are indeed invalid.

Symlinks can use a relative path, as seen in the first example at https://nodejs.org/api/fs.html#fssymlinktarget-path-type-callback.

Provide the exact sequence of commands / steps that you executed before running into the problem

  1. Install tfjs-node
  2. Move node_modules, package.json and an index.js that references tfjs
  3. Run index.js

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions