问题
When running either command:
sudo serverless package or sudo serverless deploy
I get the following traceback:
Error: ERROR: Exception: Traceback (most recent call last): File “/var/lang/lib/python3.6/shutil.py”, line 550, in move os.rename(src, real_dst) OSError: [Errno 18] Invalid cross-device link: ‘/tmp/pip-target-wqc5grcw/lib/python/setuptools’ -> ‘/var/task/setuptools’
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/base_command.py”, line 228, in _main status = self.run(options, args) File “/var/lang/lib/python3.6/site-packages/pip/_internal/cli/req_command.py”, line 182, in wrapper return func(self, options, args) File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”, line 456, in run options.target_dir, target_temp_dir, options.upgrade File “/var/lang/lib/python3.6/site-packages/pip/_internal/commands/install.py”, line 514, in _handle_target_dir target_item_dir File “/var/lang/lib/python3.6/shutil.py”, line 561, in move symlinks=True) File “/var/lang/lib/python3.6/shutil.py”, line 321, in copytree os.makedirs(dst) File “/var/lang/lib/python3.6/os.py”, line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: ‘/var/task/setuptools’
I’ve created several different projects and they work locally but they never progress beyond this invalid cross-link device Error when trying to deploy or package.
What are my options?
回答1:
Edit: I tried nuking my virtualenv, uninstalling/re-installing serverless-python-requirements
, deleting/re-pulling the lambci/lambda
Docker image, no dice.
Then, I stumbled on this GH issue. As hinted in it, the experimental Docker feature Use gRPC FUSE for file sharing seems to be the cause. I've switched it off in the Docker Preferences for now and deploys are successful.
回答2:
I just had a similar problem. See this issue for a possible solution.
In summary,
- Remove all cached packages in /Library/Caches/serverless-python-requirements/
- Remove existing docker image lambci/lambda build-python3.8
来源:https://stackoverflow.com/questions/64048687/why-does-serverless-produce-an-invalid-cross-device-link-error-when-trying-to-pa