Skip to content

create-elm-app fails on attempt to copy read-only tempalte folder #598

@ony

Description

@ony

Is this a bug report?

Yes

Environment

  1. nix shell 'nixpkgs#'nodejs --command node -v: v14.17.0
  2. nix shell 'nixpkgs#'nodejs --command npm -v: 6.14.13
  3. npm ls create-elm-app -g (if you haven’t ejected): N/A (use NixOS installation)

Then, specify:

  1. Operating system: NixOS 21.05.20210622.20d353f
  2. Browser and version (if relevant):

Steps to Reproduce

  1. nix shell 'nixpkgs#'{nodejs,elmPackages.create-elm-app} --command create-elm-app xyz
Creating xyz project...

Error: EACCES: permission denied, copyfile '/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/template/README.md' -> '/tmp/xyz/README.md'
    at Object.copyFileSync (fs.js:2059:3)
    at copyFile (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:68:8)
    at onFile (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:52:41)
    at getStats (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:47:39)
    at startCopy (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:37:10)
    at copyDirItem (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:134:10)
    at /nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:127:39
    at Array.forEach (<anonymous>)
    at copyDir (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:127:23)
    at mkDirAndCopy (/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/node_modules/fs-extra/lib/copy-sync/copy-sync.js:123:10) {
  errno: -13,
  syscall: 'copyfile',
  code: 'EACCES',
  path: '/nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/template/README.md',
  dest: '/tmp/xyz/README.md'
}

Expected Behavior

Folder with name xyz will be created with stub content for new project.

Actual Behavior

Empty folder with read-only permissions created only.

ls -lnd xyz
dr-xr-xr-x 2 1000 1000 4096 Aug 22 22:12 xyz

(notic first octet dr-x instead of drwx)

Note that permissions of original template folder in NixOS store also read-only

dr-xr-xr-x 1 0 0 80 Jan  1  1970 /nix/store/4wh8s09zfibsdpzjksy6zdzi53nklviv-node_create-elm-app-5.22.0/lib/node_modules/create-elm-app/template/

Reproducible Demo

N/A (issue with project creation 😉 : )


This seems to an issue jprichardson/node-fs-extra#629 which was closed in Feb 2020 , but create-elm-app still uses fs-extra 6.0.1 from May 2018, apparently.

"fs-extra": "6.0.1",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions