volta icon indicating copy to clipboard operation
volta copied to clipboard

Volta error: Could not create shim after a npm link command

Open ludwig-pro opened this issue 2 years ago • 4 comments

Hello !

I try to create a cli with node following this tutorial HERE and I can't create a symlink with npm link command.

➜ npm link                                
added 1 package, and audited 3 packages in 587ms
found 0 vulnerabilities
Volta error: Could not create shim for "@demain-es/create-project"
Please ensure you have correct permissions to the Volta directory.
Error details written to /Users/ludwig/.volta/log/volta-error-2022-03-19_10_30_21.298.log
# error log
"npm" "link"
Volta v1.0.5
Could not create shim for "@xxx/create-project"
Please ensure you have correct permissions to the Volta directory.
Error cause: No such file or directory (os error 2)
# b
npm link --verbose
npm verb cli [
npm verb cli   '/Users/ludwig/.volta/tools/image/node/16.13.2/bin/node',
npm verb cli   '/Users/ludwig/.volta/tools/image/npm/8.5.5/bin/npm-cli.js',
npm verb cli   'link',
npm verb cli   '--verbose'
npm verb cli ]
npm info using [email protected]
npm info using [email protected]
npm timing npm:load:whichnode Completed in 0ms
npm timing config:load:defaults Completed in 1ms
npm timing config:load:file:/Users/ludwig/.volta/tools/image/npm/8.5.5/npmrc Completed in 0ms
npm timing config:load:builtin Completed in 0ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/Users/ludwig/Sources/create-branch/.npmrc Completed in 0ms
npm timing config:load:project Completed in 3ms
npm timing config:load:file:/Users/ludwig/.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:/Users/ludwig/.volta/tmp/image/packages/scope/.tmp69YmFi/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 0ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 9ms
npm timing npm:load:configload Completed in 9ms
npm timing npm:load:setTitle Completed in 12ms
npm timing config:load:flatten Completed in 2ms
npm timing npm:load:display Completed in 7ms
npm verb logfile /Users/ludwig/.npm/_logs/2022-03-19T09_42_15_514Z-debug-0.log
npm timing npm:load:logFile Completed in 5ms
npm timing npm:load:timers Completed in 1ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 35ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 5ms
npm timing idealTree:userRequests Completed in 4ms
npm timing idealTree:#root Completed in 6ms
npm timing idealTree:node_modules/@demain-es/create-branch Completed in 0ms
npm timing idealTree:buildDeps Completed in 8ms
npm timing idealTree:fixDepFlags Completed in 0ms
npm timing idealTree Completed in 19ms
npm timing reify:loadTrees Completed in 20ms
npm timing reify:diffTrees Completed in 1ms
npm timing reify:retireShallow Completed in 0ms
npm timing reify:createSparse Completed in 0ms
npm timing reify:loadBundles Completed in 0ms
npm timing reifyNode:node_modules/@demain-es/create-branch Completed in 23ms
npm timing reify:unpack Completed in 23ms
npm timing reify:unretire Completed in 0ms
npm timing build:queue Completed in 0ms
npm timing build:deps Completed in 1ms
npm timing build:queue Completed in 0ms
npm timing build:link:node_modules/@demain-es/create-branch Completed in 1ms
npm timing build:link Completed in 1ms
npm timing build:links Completed in 1ms
npm timing build Completed in 2ms
npm timing reify:build Completed in 2ms
npm timing reify:trash Completed in 0ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 472ms
npm timing auditReport:getReport Completed in 474ms
npm timing auditReport:init Completed in 0ms
npm timing reify:audit Completed in 474ms
npm timing reify Completed in 513ms

added 1 package, and audited 3 packages in 701ms

found 0 vulnerabilities
npm timing command:link Completed in 517ms
npm verb exit 0
npm timing npm Completed in 703ms
npm info ok 
Volta error: Could not create shim for "@demain-es/create-project"

Please ensure you have correct permissions to the Volta directory.
Error details written to /Users/ludwig/.volta/log/volta-error-2022-03-19_10_42_16.224.log
➜ volta list        
⚡️ Currently active tools:

    Node: v16.13.2 (default)
    npm: v8.5.5 (default)
    Yarn: v1.22.17 (default)
    Tool binaries available:
        expo, expo-cli (default)
        gatsby (default)
        react-devtools (default)

See options for more detailed reports by running `volta list --help`.

ludwig-pro avatar Mar 19 '22 09:03 ludwig-pro

Hi @ludwig-pro, can you share the package.json for the project you're attempting to link? It appears we're trying to create a link for a binary name that has a / in it, which shouldn't be happening AFAIK.

charlespierce avatar Mar 23 '22 23:03 charlespierce

Hi ! sorry for the late answer, I was on vacation :)

this is my package.json currently ! but at the beginning, I was trying to create a npm link for that

"bin": {
    "@demain-es/create-project" : "bin/create-project"
    "create-project": "bin/create-project",
  },
{
  "name": "@ludwig-pro/create-branch",
  "version": "0.0.1",
  "author": "ludwig-pro",
  "description": "A CLI to create a git branch",
  "main": "build/index.js",
  "repository": {
    "type": "git",
    "url": "https://github.com/ludwig-pro/create-branch-cli"
  },
  "bin": {
    "create-branch": "bin/create-branch",
    "create-merge-request": "bin/create-merge-request"
  },
  "scripts": {
    "lint": "eslint --ext .ts, src",
    "tsc": "npx tsc",
    "test": "jest",
    "build": "tsc --build --force",
    "play": "./bin/create-branch"
  },
  "keywords": [
    "cli",
    "create-project"
  ],
  "license": "ISC",
  "dependencies": {
    "arg": "^5.0.1",
    "chalk": "4.1.2",
    "conf": "^10.1.1",
    "esm": "^3.2.25",
    "inquirer": "^8.2.1",
    "listr": "^0.14.3",
    "lodash": "^4.17.21"
  },
  "devDependencies": {
    "@babel/core": "^7.17.8",
    "@babel/preset-env": "^7.16.11",
    "@babel/preset-typescript": "^7.16.7",
    "@types/inquirer": "^8.2.0",
    "@types/jest": "^27.4.1",
    "@types/listr": "^0.14.4",
    "@types/lodash": "^4.14.180",
    "@types/node": "^17.0.21",
    "@typescript-eslint/eslint-plugin": "^5.15.0",
    "@typescript-eslint/parser": "^5.15.0",
    "babel-jest": "^27.5.1",
    "eslint": "^8.11.0",
    "eslint-config-prettier": "^8.5.0",
    "eslint-plugin-jest": "^26.1.1",
    "jest": "^27.5.1",
    "prettier": "2.6.0",
    "ts-node": "^10.7.0",
    "typescript": "^4.6.2"
  },
  "files": [
    "bin/",
    "build/"
  ]
}

ludwig-pro avatar Apr 03 '22 16:04 ludwig-pro

same here

sergeylukin avatar Aug 22 '22 21:08 sergeylukin

solved it too by getting rid of organizational binary alias in bin:

"bin": {
  "@<org>/<pkg>": "<path>"
}

sergeylukin avatar Aug 22 '22 22:08 sergeylukin