skypackjs / skypack-cdn

An issue tracker for the CDN
107 stars 5 forks source link

[Package Error] "@eyalsh/async_channels@v1.0.0-beta2" could not be built. #222

Open Eyal-Shalev opened 3 years ago

Eyal-Shalev commented 3 years ago

For some reason skypack fails to parse my project, and I'm not sure why. The error message is not very informative:

https://cdn.skypack.dev/error/build:@eyalsh/async_channels@v1.0.0-beta2-YjnwA26gcWjHm2a8kc3q

/*
 * [Package Error] "@eyalsh/async_channels@v1.0.0-beta2" could not be built. 
 *
 *   [1/5] Verifying package is valid…
 *   [2/5] Installing dependencies from npm…
 *   [3/5] Building package using esinstall…
 *   Running esinstall...
 *   rollup-plugin-inject: failed to parse @eyalsh/async_channels/dist/async_channels.esm.mjs. Consider restricting the plugin to particular files via options.include
 *   Failed to load node_modules/@eyalsh/async_channels/dist/async_channels.esm.mjs
 *     Unexpected token (Note that you need plugins to import files that are not JavaScript)
 *   Install failed.
 *   Install failed.
 *
 * How to fix:
 *   - If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues
 *   - If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix.
 *   - Use https://skypack.dev/ to find a web-friendly alternative to find another package.
 */

console.warn("[Package Error] \"@eyalsh/async_channels@v1.0.0-beta2\" could not be built. \n[1/5] Verifying package is valid…\n[2/5] Installing dependencies from npm…\n[3/5] Building package using esinstall…\nRunning esinstall...\nrollup-plugin-inject: failed to parse @eyalsh/async_channels/dist/async_channels.esm.mjs. Consider restricting the plugin to particular files via options.include\nFailed to load node_modules/@eyalsh/async_channels/dist/async_channels.esm.mjs\n  Unexpected token (Note that you need plugins to import files that are not JavaScript)\nInstall failed.\nInstall failed.");
throw new Error("[Package Error] \"@eyalsh/async_channels@v1.0.0-beta2\" could not be built. ");
export default null;

Is there somewhere else I can find a more detailed reason for the failure (beside Unexpected token);

Important note: I am able to install the project via NPM

Eyal-Shalev commented 3 years ago

I found the bug. It seems like your build process does not support private class methods (leaving this open in case you consider it a bug). The following will cause it to fail.

class A {
  #greet(name) {
    return `Hello ${name}`;
  }
}
barthuijgen commented 2 years ago

Found the same issue in a different package: https://cdn.skypack.dev/error/build:kysely@v0.16.2-vyDDRpD0hFnnWjL1lYF0

I definitely think this is a bug since esbuild does support the private operator, see: https://esbuild.github.io/content-types/#javascript

regseb commented 2 years ago

I have the same error with Cronnor (src/cron.js#L117):

/*
 * [Package Error] "cronnor@v2.0.0" could not be built. 
 *
 *   [1/5] Verifying package is valid…
 *   [2/5] Installing dependencies from npm…
 *   [3/5] Building package using esinstall…
 *   Running esinstall...
 *   Failed to load node_modules/cronnor/src/cron.js
 *     Unexpected token (117:4) in cronnor/src/cron.js
 *   Install failed.
 *   Install failed.
 *
 * How to fix:
 *   - If you believe this to be an error in Skypack, file an issue here: https://github.com/skypackjs/skypack-cdn/issues
 *   - If you believe this to be an issue in the package, share this URL with the package authors to help them debug & fix.
 *   - Use https://skypack.dev/ to find a web-friendly alternative to find another package.
 */

console.warn("[Package Error] \"cronnor@v2.0.0\" could not be built. \n[1/5] Verifying package is valid…\n[2/5] Installing dependencies from npm…\n[3/5] Building package using esinstall…\nRunning esinstall...\nFailed to load node_modules/cronnor/src/cron.js\n  Unexpected token (117:4) in cronnor/src/cron.js\nInstall failed.\nInstall failed.");
throw new Error("[Package Error] \"cronnor@v2.0.0\" could not be built. ");
export default null;

Snowpack (parent project of esinstall) isn't maintained:

Update (April 20, 2022): Snowpack is no longer actively maintained and is not recommended for new projects.

Check out Vite for a well-maintained Snowpack alternative.
See also: esbuild, parcel