Skip to content

"npm run preview" isn't correct #1

@tinanoob

Description

@tinanoob

Problem

The "preview" script in package.json is wrong. See reproduction below.

Looks like boilerplate taken from analog needs correction.
Specifically this command

  • cross-env NODE_ENV=production node dist/analog/server/index.mjs

Unfortunately I don't know anything about nitro or analog, so I don't know what this command should be.

To Reproduce

Clone the repo, then

npm i
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. 
Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, 
which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Use your platform's native DOMException instead

added 650 packages, and audited 652 packages in 18s

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

4 moderate severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
npm run build
> [email protected] build
> vite build

vite v6.3.4 building for production...
vite v6.3.4 building SSR bundle for production...
✓ 4 modules transformed.
dist/ssr/main.server.js  1.91 kB
✓ built in 364ms
✓ 31 modules transformed.
dist/client/index.html                   0.49 kB │ gzip:  0.33 kB
dist/client/assets/react-CHdo91hT.svg    4.13 kB │ gzip:  2.05 kB
dist/client/assets/index-4fUBZJxo.css    1.40 kB │ gzip:  0.72 kB
dist/client/assets/index-CA3yFx6P.js   188.36 kB │ gzip: 59.40 kB
✓ built in 1.15s
Prerendering static pages...
Building Server...
Observe
The '@analogjs/platform' server has been successfully built.

Then
% npm run preview

> [email protected] preview
> cross-env NODE_ENV=production node dist/analog/server/index.mjs

node:internal/modules/cjs/loader:1408
  throw err;
  ^

Error: Cannot find module '/tmp/vite-nitro-react/dist/analog/server/index.mjs'
    at Function._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:151:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v23.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions