Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ENOENT: no such file or directory, symlink on Windows #4293

Open
derek-duncan opened this issue Aug 31, 2017 · 3 comments
Open

Error: ENOENT: no such file or directory, symlink on Windows #4293

derek-duncan opened this issue Aug 31, 2017 · 3 comments

Comments

@derek-duncan
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
When running yarn on Windows Bash to setup a workspaces project, an error occurs when trying to symlink the local packages. My primary dev device is a mac, and workspaces has been working flawlessly there. Not sure how to proceed, so looking for help. Thanks!

Arguments: 
  /usr/bin/nodejs /root/.yarn/bin/yarn.js install

PATH: 
  /root/.yarn/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files (x86)/Intel/iCLS Client:/mnt/c/Program Files/Intel/iCLS Client:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/Git/mingw64/bin:/mnt/c/Program Files/Git/usr/bin:/mnt/c/Program Files/nodejs:/mnt/c/Program Files (x86)/Yarn/bin:/mnt/c/Users/Derek Duncan/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Derek Duncan/AppData/Roaming/npm:/mnt/c/Program Files/Microsoft VS Code/bin

Yarn version: 
  1.0.0-20170829.1752

Node version: 
  8.4.0

Platform: 
  linux x64

npm manifest: 
  {
    "private": true,
    "name": "...",
    "version": "1.4.0",
    "description": "...",
    "scripts": {
      "build": "lerna run build",
      "build:watch": "lerna run --parallel build -- -- -w",
      "flow": "flow",
      "flow:install": "flow-typed install",
      "format": "./scripts/format.sh",
      "lint": "./scripts/lint.sh",
      "precommit": "lint-staged",
      "setup": "./scripts/setup.sh",
      "storybook": "start-storybook -p 9001 -c .storybook",
      "test": "./scripts/test.sh",
      "test:watch": "yarn run test -- --watch"
    },
    "lint-staged": {
      "*.js": [
        "./scripts/format-staged.sh",
        "git add"
      ]
    },
    "repository": { ... },
    "author": { ... },
    "workspaces": [
      "packages/*"
    ],
    "license": "MIT",
    "dependencies": {},
    "devDependencies": {
      "@storybook/addon-centered": "^3.1.9",
      "@storybook/addon-knobs": "^3.1.9",
      "@storybook/react": "^3.1.9",
      "babel-core": "^6.25.0",
      "babel-eslint": "^7.1.1",
      "babel-jest": "^20.0.3",
      "babel-loader": "^7.1.1",
      "babel-plugin-add-module-exports": "^0.2.1",
      "babel-plugin-dev-expression": "^0.2.1",
      "babel-plugin-flow-runtime": "^0.11.1",
      "babel-plugin-lodash": "^3.2.11",
      "babel-plugin-transform-class-properties": "^6.22.0",
      "babel-plugin-transform-es2015-classes": "^6.22.0",
      "babel-plugin-transform-react-stateless-component-name": "^1.1.1",
      "babel-polyfill": "^6.22.0",
      "babel-preset-env": "^1.6.0",
      "babel-preset-react": "^6.22.0",
      "babel-preset-react-hmre": "^1.1.1",
      "babel-preset-react-optimize": "^1.0.1",
      "babel-preset-stage-0": "^6.22.0",
      "babel-register": "^6.22.0",
      "babili-webpack-plugin": "^0.1.2",
      "benchmark": "^2.1.4",
      "emotion": "^6.0.3",
      "enzyme": "^2.9.1",
      "enzyme-to-json": "^1.5.1",
      "eslint": "^4.1.1",
      "eslint-config-prettier": "^2.3.0",
      "eslint-formatter-pretty": "^1.1.0",
      "eslint-plugin-flowtype": "^2.34.1",
      "eslint-plugin-flowtype-errors": "^3.3.1",
      "eslint-plugin-import": "^2.7.0",
      "eslint-plugin-jest": "^20.0.3",
      "eslint-plugin-jsx-a11y": "^6.0.2",
      "eslint-plugin-prettier": "^2.1.2",
      "eslint-plugin-react": "^7.1.0",
      "flow-bin": "^0.51.1",
      "flow-runtime": "^0.14.0",
      "flow-typed": "^2.1.5",
      "husky": "^0.14.3",
      "jest": "^20.0.4",
      "jsdom": "^11.1.0",
      "lerna": "^2.0.0",
      "lint-staged": "^4.0.2",
      "prettier": "^1.5.3",
      "react-hot-loader": "3.0.0-beta.6",
      "react-test-renderer": "^15.6.1"
    }
  }

yarn manifest: 
  No manifest

Lockfile: 
  No lockfile

Trace: 
  Error: ENOENT: no such file or directory, symlink '../packages/itp-analytics' -> '/mnt/c/Users/Derek Duncan/code/desktop/node_modules/itp-analytics'

If the current behavior is a bug, please provide the steps to reproduce.
Running yarn from the root directory in a workspaces project on Windows.

What is the expected behavior?

Please mention your node.js, yarn and operating system version.
node v8.4.0, yarn nightly 1.0.0-20170829.1752 , os Windows 10 (Bash)

@safizn
Copy link

safizn commented Aug 5, 2018

I'm experiencing the same issue. At first I thought it was related to the symlinks I was creating for the workspaces.
Any workaround ?

@safizn
Copy link

safizn commented Aug 6, 2018

I've noticed that the issue is with the unlink function of rimraf package in https://github.com/isaacs/rimraf/blob/master/rimraf.js#L128

It causes symlinks to be corrupted.

Temporary fix:
commenting out the following yarn line fixes the issue on a second yarn install (when symlinks already present in the node_modules). -

await unlink(dest);

The modules at the end map to the Linux filesystem function, specifically unlink - https://unix.stackexchange.com/questions/151951/what-is-the-difference-between-rm-and-unlink

I believe that unlinking a symlink in Docker containers causes the issue, as the file is still being used by Docker it won't be removed, and will be corrupt when trying to access it. (shutting down Docker removes the file). According to the documentation of unlink unix - https://linux.die.net/man/2/unlink , the file won't be deleted if used.

@safizn
Copy link

safizn commented Aug 7, 2018

There are different issues in Yarn open based on the behavior of Node.js fs.unlink module.
This conversation summarizes the cause - nodejs/node-v0.x-archive#7164

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants