fresh icon indicating copy to clipboard operation
fresh copied to clipboard

Unknown issue with npm specifier

Open Sleepful opened this issue 1 year ago • 9 comments

Currently I can run a version of fresh, but what if I want to run the latest commit? I want to run these changes but I don't want to wait for a version release: https://github.com/denoland/fresh/pull/1841

Sleepful avatar Oct 06 '23 23:10 Sleepful

Alright I tried doing this:

deno.json

    "$fresh/": "https://raw.githubusercontent.com/denoland/fresh/main/",

but npm specifier still broken inside islands directory.

Sleepful avatar Oct 06 '23 23:10 Sleepful

@Sleepful Just checked and npm specifiers work without issues for me. What does "is still broken" mean in your comment? Is there a specific module that you are trying to use that isn't working? Can you share the code that triggers the error?

marvinhagemeister avatar Oct 07 '23 00:10 marvinhagemeister

Oh, thanks for the prompt response. I will share more info when I'm back at the kbd!

Sleepful avatar Oct 07 '23 00:10 Sleepful

I'm having the same issue with npm specifiers in islands specifically on deploy. Logs
Island causing the errors Deno config in which nodeModulesDir is set to true Has been tested on 1.4.3, 1.5, and 1.5.1 and still occurs

Blocksnmore avatar Oct 09 '23 19:10 Blocksnmore

@marvinhagemeister

import {
  initializePaddle,
  Paddle,
  PaddleEventData,
} from "npm:@paddle/[email protected]";
Logs
Done in 236ms.
✘ [ERROR] Could not resolve "@paddle/paddle-js" [plugin deno-loader]

    islands/checkout.tsx:5:7:
      5 │ } from "npm:@paddle/[email protected]";
        ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  You can mark the path "@paddle/paddle-js" as external to exclude it from the bundle, which
  will remove this error and leave the unresolved path in the bundle.

An error occurred during route handling or page rendering.
An error occurred during route handling or page rendering.
Error: Build failed with 1 error:
islands/checkout.tsx:5:7: ERROR: [plugin: deno-loader] Could not resolve "@paddle/paddle-js"
    at failureErrorWithLog (https://deno.land/x/[email protected]/mod.js:1626:15)
    at https://deno.land/x/[email protected]/mod.js:1035:25
    at runOnEndCallbacks (https://deno.land/x/[email protected]/mod.js:1461:45)
    at buildResponseToResult (https://deno.land/x/[email protected]/mod.js:1033:7)
    at https://deno.land/x/[email protected]/mod.js:1062:16
    at responseCallbacks.<computed> (https://deno.land/x/[email protected]/mod.js:679:9)
    at handleIncomingPacket (https://deno.land/x/[email protected]/mod.js:739:9)
    at readFromStdout (https://deno.land/x/[email protected]/mod.js:655:7)
    at https://deno.land/x/[email protected]/mod.js:1924:11
    at eventLoopTick (ext:core/01_core.js:183:11) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}
Error: Build failed with 1 error:
islands/checkout.tsx:5:7: ERROR: [plugin: deno-loader] Could not resolve "@paddle/paddle-js"
    at failureErrorWithLog (https://deno.land/x/[email protected]/mod.js:1626:15)
    at https://deno.land/x/[email protected]/mod.js:1035:25
    at runOnEndCallbacks (https://deno.land/x/[email protected]/mod.js:1461:45)
    at buildResponseToResult (https://deno.land/x/[email protected]/mod.js:1033:7)
    at https://deno.land/x/[email protected]/mod.js:1062:16
    at responseCallbacks.<computed> (https://deno.land/x/[email protected]/mod.js:679:9)
    at handleIncomingPacket (https://deno.land/x/[email protected]/mod.js:739:9)
    at readFromStdout (https://deno.land/x/[email protected]/mod.js:655:7)
    at https://deno.land/x/[email protected]/mod.js:1924:11
    at eventLoopTick (ext:core/01_core.js:183:11) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]
}

Sleepful avatar Oct 21 '23 20:10 Sleepful

this works fine though:

// inside /islands dir
import {
  initializePaddle,
  Paddle,
  PaddleEventData,
} from "https://esm.sh/@paddle/[email protected]";

Sleepful avatar Oct 21 '23 20:10 Sleepful

@Sleepful Just tried the npm:@paddle/[email protected] import in an island in an new Fresh 1.5.2 project and I get no error.

marvinhagemeister avatar Oct 21 '23 21:10 marvinhagemeister

A co-worker just tried to spin up a new Fresh project using the command in the docs, and (out of curiosity) I asked him to change the imports in deno.json from esm.sh to npm:. deno task start ran fine, but on loading the page we got errors on the server terminal about being unable to move temporaries into place because directories in ~/.cache/deno/deno_esbuild already existed.

eternaleye avatar Nov 21 '23 23:11 eternaleye

Hm, I don't think I can provide more information about the issue right now. It seems that we are at a “works on my machine” cross-roads.

Sleepful avatar Nov 24 '23 22:11 Sleepful

Closing as we don't have sufficient information to help guide/debug this issue further.

marvinhagemeister avatar Mar 12 '24 11:03 marvinhagemeister