press icon indicating copy to clipboard operation
press copied to clipboard

Errors on trying to use inside nuxt-i18n repo

Open rchl opened this issue 6 years ago • 8 comments

  1. git clone [email protected]:nuxt-community/nuxt-i18n.git
  2. cd nuxt-i18n
  3. yarn add -D @nuxt/press (nuxt is already installed)
  4. Modify docs:build script in package.json to run nuxt generate
  5. yarn docs:build

Getting this warning and error:

 WARN  locale '' not supported, falling back to en

and then:

FATAL  Cannot find module '/Users/rrr/nuxt-i18n/dist/_press/sources/docs//'                                                 08:01:54
Require stack:
- /Users/rrr/nuxt-i18n/node_modules/@nuxt/press/dist/nuxt-press.js
- /Users/rrr/nuxt-i18n/node_modules/@nuxt/core/dist/core.js
- /Users/rrr/nuxt-i18n/node_modules/@nuxt/cli/dist/cli-command.js
- /Users/rrr/nuxt-i18n/node_modules/@nuxt/cli/dist/cli.js
- /Users/rrr/nuxt-i18n/node_modules/nuxt/bin/nuxt.js

  Error: Cannot find module 'dist/_press/sources/docs//'
  Require stack:
  - node_modules/@nuxt/press/dist/nuxt-press.js
  - node_modules/@nuxt/core/dist/core.js
  - node_modules/@nuxt/cli/dist/cli-command.js
  - node_modules/@nuxt/cli/dist/cli.js
  - node_modules/nuxt/bin/nuxt.js
  at node_modules/@nuxt/press/dist/nuxt-press.js:85:90
  at new Promise (<anonymous>)
  at importModule (node_modules/@nuxt/press/dist/nuxt-press.js:85:31)
  at ModuleContainer.generateRoutes (node_modules/@nuxt/press/dist/nuxt-press.js:1297:24)
  at distCopied (node_modules/@nuxt/press/dist/nuxt-press.js:1829:57)

rchl avatar Aug 27 '19 06:08 rchl

When running nuxt dev instead, there is no error on building (just the locale warning), but I don't seem to be able to access any page - both http://localhost:3000/, http://localhost:3000/seo or http://localhost:3000/docs/seo return "page not found".

Auto-generated nuxt.press.json looks like this:

{
  "docs": {
    "dir": "docs",
    "prefix": "/docs/",
    "title": "My Documentation",
    "search": true,
    "nav": []
  }
}

rchl avatar Aug 27 '19 06:08 rchl

The warning WARN locale '' not supported, falling back to en originates from the search indexer of nuxt-community/lunr-module

pimlie avatar Aug 27 '19 06:08 pimlie

From which folder do you run nuxt dev? If you are in the root of your repo you should pass the docs root dir to nuxt like nuxt dev docs. The dir option of nuxt.press.json is relative to the nuxt rootDir, see eg https://github.com/nuxt/press/blob/develop/docs/nuxt.press.json

-- edit -- or actually relative to the nuxt srcDir to be correct, they just happen to be the same often :)

pimlie avatar Aug 27 '19 06:08 pimlie

I'm running nuxt dev from root of the repo, and both nuxt.config.js and nuxt.press.json are also in the root (were created automatically there).

rchl avatar Aug 27 '19 07:08 rchl

I think this is fixed by 7e4580a1e9ce818d3399308571bdde0dcc37cd2a, at least I c an succesfully run the docs with config files in the repo root.

pimlie avatar Aug 27 '19 08:08 pimlie

That seems to work. With prefix option set, navigating to root path (http://localhost:3000/) throws ugly error but that's probably different bug.

rchl avatar Aug 27 '19 09:08 rchl

Dont be like that, show me the error/bug! ;)

pimlie avatar Aug 27 '19 09:08 pimlie

Since bugfix is not released yet I had to do crazy stuff to test but:

yarn add -D git+ssh://[email protected]:nuxt/press#develop
cd node_modules/@nuxt/press
yarn && yarn dist
cd -
yarn docs:dev

NuxtServerError: Cannot find module './'

Screenshot 2019-08-27 at 12 12 06

rchl avatar Aug 27 '19 10:08 rchl