withastro / astro

The web framework for content-driven websites. ⭐️ Star to support our work!
https://astro.build
Other
46.82k stars 2.49k forks source link

🐛 BUG: Project doesn't run right after initialization #807

Closed jerriclynsjohn closed 3 years ago

jerriclynsjohn commented 3 years ago

What package manager are you using?

npm v7.20.0

What operating system are you using?

Windows

Describe the Bug

The project throws an error right after initialization.

UnhandledPromiseRejectionWarning: Error: Cannot find module 'D:\CodeBase\astro-sample\node_modules\astro\snowpack-plugin-jsx.cjs'
Require stack:
- D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\util.js
- D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\commands\add-rm.js
- D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)  
    at Object.require [as NATIVE_REQUIRE] (internal/modules/cjs/helpers.js:88:18)
    at loadPluginFromConfig (D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:285:34)
    at D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:315:24
    at Array.forEach (<anonymous>)
    at loadPlugins (D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:312:20)
    at normalizeConfig (D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:434:39)
    at createConfiguration (D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:656:30)
    at loadConfiguration (D:\CodeBase\astro-sample\node_modules\snowpack\lib\cjs\config.js:734:16)
    at async createSnowpack (file:///D:/CodeBase/astro-sample/node_modules/astro/dist/runtime.js:275:26)
    at async createRuntime (file:///D:/CodeBase/astro-sample/node_modules/astro/dist/runtime.js:335:7)
    at async dev (file:///D:/CodeBase/astro-sample/node_modules/astro/dist/dev.js:17:19)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not 
handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Steps to Reproduce

  1. npm init astro using template Svelte Components
  2. npm install
  3. npm run start
  4. Error as as shown above

Link to Minimal Reproducible Example (Optional)

No response

snelgrove commented 3 years ago

I'm seeing a similar problem on a Mac, Node 16.2.0, NPM 7.13.0 and the Astro project references "0.18.0-next.3"

node:internal/modules/cjs/loader:941
  const err = new Error(message);
              ^

Error: Cannot find module '/Users/matt/Code/sample/node_modules/astro/snowpack-plugin-jsx.cjs'
Require stack:
- /Users/matt/Code/sample/node_modules/snowpack/lib/cjs/util.js
- /Users/matt/Code/sample/node_modules/snowpack/lib/cjs/commands/add-rm.js
- /Users/matt/Code/sample/node_modules/snowpack/lib/cjs/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:941:15)
    at Function.Module._load (node:internal/modules/cjs/loader:774:27)
    at Module.require (node:internal/modules/cjs/loader:1013:19)
    at Object.require [as NATIVE_REQUIRE] (node:internal/modules/cjs/helpers:93:18)
    at loadPluginFromConfig (/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:285:34)
    at /Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:315:24
    at Array.forEach (<anonymous>)
    at loadPlugins (/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:312:20)
    at normalizeConfig (/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:434:39)
    at createConfiguration (/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:656:30)
    at loadConfiguration (/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/config.js:734:16)
    at async createSnowpack (file:///Users/matt/Code/sample/node_modules/astro/dist/runtime.js:275:26)
    at async createRuntime (file:///Users/matt/Code/sample/node_modules/astro/dist/runtime.js:335:7)
    at async dev (file:///Users/matt/Code/sample/node_modules/astro/dist/dev.js:17:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/util.js',
    '/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/commands/add-rm.js',
    '/Users/matt/Code/sample/node_modules/snowpack/lib/cjs/index.js'
  ]
}
FredKSchott commented 3 years ago

Thanks for filing! This was a next release that wasn't meant to go out under latest. Just fixed it, and npm init astro should be working again