jsr-io / jsr-npm

A cli tool to make installing packages form jsr.io in node easy
https://npmjs.com/package/jsr
MIT License
92 stars 13 forks source link

"Cannot find module '(...)\node_modules\jsr\dist\bin.js'" #38

Closed vxern closed 3 months ago

vxern commented 5 months ago

I've installed JSR to my project using npm install --save-dev jsr, which worked fine, and I could then run npx jsr --help to get the JSR help menu:

PS C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper> npm install --save-dev jsr

added 3 packages, and audited 121 packages in 2s

34 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
PS C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper> npx jsr --help
jsr.io cli for node

Usage:
     jsr add @std/log  Install the "@std/log" package from jsr.io.
  jsr remove @std/log  Remove the "@std/log" package from the project.

Commands:
       i, install, add  Install one or more JSR packages.
  r, uninstall, remove  Remove one or more JSR packages.
               publish  Publish a package to the JSR registry.

Options:
      -P, --save-prod  Package will be added to dependencies. This is the default.
       -D, --save-dev  Package will be added to devDependencies.
  -O, --save-optional  Package will be added to optionalDependencies.
                --npm  Use npm to remove and install packages.
               --yarn  Use yarn to remove and install packages.
               --pnpm  Use pnpm to remove and install packages.
                --bun  Use bun to remove and install packages.
            --verbose  Show additional debugging information.
           -h, --help  Show this help text.
        -v, --version  Print the version number.

Publish Options:
     --token <Token>  The API token to use when publishing. If unset, interactive authentication will be used.
           --dry-run  Prepare the package for publishing performing all checks and validations without uploading.
  --allow-slow-types  Allow publishing with slow types.
        --provenance  From CI/CD system, publicly links the package to where it was built and published from.

Environment variables:
        JSR_URL  Use a different registry URL for the publish command.
  DENO_BIN_PATH  Use specified Deno binary instead of local downloaded one.

However, upon running npx jsr publish, I get the following error:

PS C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper> npx jsr publish   
Downloading JSR binary...
[00:01] [#################################################>] 35.3 MiB/35.5 MiB
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/index.ts:2:19
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/index.ts:3:86
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/index.ts:4:29
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/index.ts:5:28
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/inflection.ts:2:25
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/inflection.ts:3:23
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/inflection.ts:4:52
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis.ts:2:25 
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis.ts:3:23 
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis.ts:4:67 
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis.ts:5:21 
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis.ts:6:22
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/constants/selectors.ts:1:29
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis/row.ts:2:37
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis/row.ts:3:23
Warning Sloppy module resolution (hint: update .js extension to .ts)
    at file:///C:/Users/Administrator/Documents/Programming/Projects/Public/dexonline-scraper/src/tabs/synthesis/row.ts:4:31
error: Failed creating junction and fallback symlink in node_modules folder.

Cannot create a file when that file already exists. (os error 183)

Cannot create a file when that file already exists. (os error 183), symlink 'C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper\node_modules\.deno\jsr@0.9.0\node_modules\jsr' -> 'C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper\node_modules\jsr'

After which, npx jsr becomes unavailable:

PS C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper> npx jsr
node:internal/modules/cjs/loader:1051
  throw err;
  ^

Error: Cannot find module 'C:\Users\Administrator\Documents\Programming\Projects\Public\dexonline-scraper\node_modules\jsr\dist\bin.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.6.1

Installing jsr as a global package works just fine, however.

Installation information

NPM version: 10.1.0 Node.js version: 20.6.1 Operating system: Windows 10 Package/repository: https://github.com/vxern/dexonline-scraper

marvinhagemeister commented 3 months ago

Just tested this and I cannot reproduce the described issue anymore (tested macOS + windows 11). Not sure which change fixed it, but it seems resolved.