Code Monkey home page Code Monkey logo

Comments (11)

Diizzayy avatar Diizzayy commented on May 27, 2024 5

@krank56 @denis-gorin Thank you for raising this issue and providing the relevant details.

This appears to be an upstream bug with the nuxt 3 production server bundle on windows. We're looking into it and will address this as soon as possible.

from nuxt-graphql-client.

mateuszkulpa avatar mateuszkulpa commented on May 27, 2024 3

Hello,
I found an alternative workaround for this issue. After build, you should use --experimental-specifier-resolution=node flag to start your app.

node --es-module-specifier-resolution=node .output/server/index.mjs

I believe this issue is caused by import of graphql/language/parser without .mjs extension in output chunks.

from nuxt-graphql-client.

Diizzayy avatar Diizzayy commented on May 27, 2024 2

Seems that is a common problem when bundling Nuxt 3 under Windows OSes.

@PrinceEntree8 Indeed, this issue solely exists in the windows environment due to the way bundling occurs in current versions of Nuxt 3. I'll continue to keep a close eye on this one and update the status here accordingly.

Hopefully though, we can have this resolved and working properly on Windows in the near future.

from nuxt-graphql-client.

maximilliangeorge avatar maximilliangeorge commented on May 27, 2024 1

Sure. Build works fine, but when I try running the server as per the output You can preview this build using node server/output/server/index.mjs I get the following error.

The workaround mentioned above allows me to run the server.

My system:

  • Operating System: Darwin
  • Node Version: v16.13.1
  • Nuxt Version: 3.4.3
  • Nitro Version: 2.4.1
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: app, modules, css, components, runtimeConfig, piniaPersistedstate, graphql-client, vite, nitro
  • Runtime Modules: @pinia/[email protected], @pinia-plugin-persistedstate/[email protected], [email protected]
  • Build Modules: -

``
maximillian@mac nuxt % node server/output/server/index.mjs
node:internal/process/esm_loader:94
internalBinding('errors').triggerUncaughtException(
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '***/nuxt/server/output/server/node_modules/graphql/language/parser' imported from ***/nuxt/server/output/server/index.mjs
Did you mean to import graphql/language/parser.js?
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:416:11)
at moduleResolve (node:internal/modules/esm/resolve:932:10)
at defaultResolve (node:internal/modules/esm/resolve:1044:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)
at ModuleWrap. (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36) {
code: 'ERR_MODULE_NOT_FOUND'
}

from nuxt-graphql-client.

Diizzayy avatar Diizzayy commented on May 27, 2024

@krank56 would you be able to provide a simple reproduction where this error occurs with the build?

I've been unable to replicate it on the demo app, you can have a look at my config below.


  • Operating System: Linux
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.4
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: modules, runtimeConfig
  • Runtime Modules: [email protected]
  • Build Modules: -

from nuxt-graphql-client.

denis-gorin avatar denis-gorin commented on May 27, 2024

The same error on plain nuxt-graphql-client-demo installation

[nuxt] [request error] Cannot find module 'C:\[mypath]\nuxt-graphql-client-demo\.output\server\node_modules\graphql\language\parser' imported from C:\[mypath]\nuxt-graphql-client-demo\.output\server\chunks\server.mjs

Did you mean to import graphql-client-demo/node_modules/graphql/language/parser.js?

at new NodeError (node:internal/errors:372:5)
...

the same configurations except Operating System - Windows and yarn v 1.22.19

  • Operating System: Linux
  • Node Version: v16.15.1
  • Nuxt Version: 3.0.0-rc.4
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: modules, runtimeConfig
  • Runtime Modules: [email protected]
  • Build Modules: -

steps to reproduce

  • yarn install
  • yarn build

catch error:


yarn run v1.22.19
$ nuxi build
Nuxt CLI v3.0.0-rc.4                                                                                                                                                                                                                                 14:30:40

 ERROR  (node:825780) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time                                                                                                                             14:30:48
(Use `node --trace-warnings ...` to show where the warning was created)

i Vite client warmed up in 2446ms                                                                                                                                                                                                                    14:30:52
i Client built in 3882ms                                                                                                                                                                                                                             14:30:54
i Building server...                                                                                                                                                                                                                                 14:30:54
√ Server built in 1134ms                                                                                                                                                                                                                             14:30:55
√ Generated public .output/public                                                                                                                                                                                                              nitro 14:30:55
start Building server...                                                                                                                                                                                                                       nitro 14:30:55

 ERROR  (node:825780) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./public/" in the "exports" field module resolution of the package at C:\[mypath]\nuxt-graphql-client-demo\node_modules\extract-files\package.json imported from C:\[mypath]\nuxt-graphql-client-demo\node_modules.
Update this package.json to use a subpath pattern like "./public/*".

start Writing server bundle...                                                                                                                                                                                                                 nitro 14:31:01
√ Server built                                                                                                                                                                                                                                 nitro 14:31:02
  ├─ .output/server/package.json (454 B) (236 B gzip)
  ├─ .output/server/index.mjs (452 B) (253 B gzip)
  ├─ .output/server/chunks/server.mjs.map (221 kB) (31.9 kB gzip)
  ├─ .output/server/chunks/server.mjs (195 kB) (46.1 kB gzip)
  ├─ .output/server/chunks/renderer.mjs.map (1.92 MB) (91.3 kB gzip)
  ├─ .output/server/chunks/renderer.mjs (431 kB) (98.7 kB gzip)
  ├─ .output/server/chunks/node-server.mjs.map (58.4 kB) (4.41 kB gzip)
  ├─ .output/server/chunks/node-server.mjs (16.1 kB) (5.2 kB gzip)
  ├─ .output/server/chunks/client.manifest.mjs.map (376 B) (249 B gzip)
  └─ .output/server/chunks/client.manifest.mjs (314 B) (210 B gzip)
Σ Total size: 3.73 MB (475 kB gzip)
√ You can preview this build using node .output/server/index.mjs             
  • yarn start

from nuxt-graphql-client.

PrinceEntree8 avatar PrinceEntree8 commented on May 27, 2024

Hello, it seems that using Nuxt v3.0.0-rc.6, the error still persists

  • Operating System: Windows 10 Pro 21H1
  • Node Version: v16.156.0
  • Nuxt Version: 3.0.0-rc.6
  • Package Manager: [email protected]
  • Builder: vite
  • User Config: modules
  • Runtime Modules: [email protected]
yarn run v1.22.19
$ nuxi build
Nuxt CLI v3.0.0-rc.6                                                                                                                                                       18:38:01
i Client built in 10332ms                                                                                                                                                  18:38:19
i Building server...                                                                                                                                                       18:38:19

 WARN  @fortawesome/fontawesome-free doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension
 for the entry point). Please contact the package author to fix.

√ Server built in 5230ms                                                                                                                                                   18:38:24
√ Generated public .output/public                                                                                                                                    nitro 18:38:25
start Building server...                                                                                                                                             nitro 18:38:27

 ERROR  (node:6456) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./public/" in the "exports" field module resolution of the package at C:\[mypath]\frontend\node_modules\extract-files\package.json imported from C:\[mypath]\frontend\node_modules.
Update this package.json to use a subpath pattern like "./public/*".
(Use `node --trace-deprecation ...` to show where the warning was created)

start Writing server bundle...                                                                                                                                       nitro 18:38:35
√ Server built                                                                                                                                                       nitro 18:38:36
  ├─ .output/server/package.json (595 B) (292 B gzip)
  ├─ .output/server/index.mjs (452 B) (253 B gzip)
  ├─ .output/server/chunks/stages.79b17bdd.mjs.map (2.09 kB) (805 B gzip)
  ├─ .output/server/chunks/stages.79b17bdd.mjs (2.4 kB) (966 B gzip)
  ├─ .output/server/chunks/server.mjs.map (670 kB) (87.2 kB gzip)
  ├─ .output/server/chunks/server.mjs (676 kB) (131 kB gzip)
  ├─ .output/server/chunks/renderer.mjs.map (1.92 MB) (91.4 kB gzip)
  ├─ .output/server/chunks/renderer.mjs (431 kB) (98.6 kB gzip)
  ├─ .output/server/chunks/node-server.mjs.map (63.2 kB) (4.46 kB gzip)
  ├─ .output/server/chunks/node-server.mjs (138 kB) (30.9 kB gzip)
  ├─ .output/server/chunks/index.8c2a10ff.mjs.map (1.98 kB) (771 B gzip)
  ├─ .output/server/chunks/index.8c2a10ff.mjs (2.51 kB) (959 B gzip)
  ├─ .output/server/chunks/index.53596502.mjs.map (1.5 kB) (658 B gzip)
  ├─ .output/server/chunks/index.53596502.mjs (1.87 kB) (812 B gzip)
  ├─ .output/server/chunks/error-component.3c5fa1a2.mjs.map (2.4 kB) (866 B gzip)
  ├─ .output/server/chunks/error-component.3c5fa1a2.mjs (2.44 kB) (1.03 kB gzip)
  ├─ .output/server/chunks/error-500.1b5f344e.mjs.map (1.79 kB) (683 B gzip)
  ├─ .output/server/chunks/error-500.1b5f344e.mjs (3.21 kB) (1.4 kB gzip)
  ├─ .output/server/chunks/error-404.fb6cd884.mjs.map (2.53 kB) (919 B gzip)
  ├─ .output/server/chunks/error-404.fb6cd884.mjs (4.09 kB) (1.69 kB gzip)
  ├─ .output/server/chunks/default.921c189e.mjs.map (19.1 kB) (3.5 kB gzip)
  ├─ .output/server/chunks/default.921c189e.mjs (30.7 kB) (8.72 kB gzip)
  ├─ .output/server/chunks/client.manifest.mjs.map (14.6 kB) (955 B gzip)
  ├─ .output/server/chunks/client.manifest.mjs (20.7 kB) (5.33 kB gzip)
  ├─ .output/server/chunks/_id_.c7b50a29.mjs.map (1.67 kB) (694 B gzip)
  └─ .output/server/chunks/_id_.c7b50a29.mjs (1.91 kB) (836 B gzip)
Σ Total size: 5.4 MB (814 kB gzip)
√ You can preview this build using node .output/server/index.mjs                                                                                                     nitro 18:38:37  
Done in 35.74s.

Update

Seems that is a common problem when bundling Nuxt 3 under Windows OSes.

I've managed to solve this issue using WSL and Docker

WSL

  1. Open a terminal in your project folder
  2. Run wsl or wsl -d <distro-name> (ex. wsl -d Fedora)
  3. Install node (and yarn optionally) sudo dnf install nodejs or sudo apt install nodejs
  4. Make sure to delete node_packages or it won't work!
  5. Run npm install -g nuxi and npm install (I'm using nuxi-cli because nuxt won't compile)
  6. Finally run nuxi build

from nuxt-graphql-client.

khelil avatar khelil commented on May 27, 2024

Any news on this ? I'm having the issue deploying to WP Engine Atlas.

from nuxt-graphql-client.

maximilliangeorge avatar maximilliangeorge commented on May 27, 2024

@PrinceEntree8 Indeed, this issue solely exists in the windows environment due to the way bundling occurs in current versions of Nuxt 3. I'll continue to keep a close eye on this one and update the status here accordingly.

Just thought I'd mention that I'm seeing this error on macOS also. Let me know if I can provide any supporting information, I'd be happy to help.

from nuxt-graphql-client.

PrinceEntree8 avatar PrinceEntree8 commented on May 27, 2024

@PrinceEntree8 Indeed, this issue solely exists in the windows environment due to the way bundling occurs in current versions of Nuxt 3. I'll continue to keep a close eye on this one and update the status here accordingly.

Just thought I'd mention that I'm seeing this error on macOS also. Let me know if I can provide any supporting information, I'd be happy to help.

Hello @maximilliangeorge, I personally use both platforms (MacOS and Windows) and I never encounter it.
Can you provide a log and more details on your setup?

from nuxt-graphql-client.

PrinceEntree8 avatar PrinceEntree8 commented on May 27, 2024

@PrinceEntree8 Indeed, this issue solely exists in the windows environment due to the way bundling occurs in current versions of Nuxt 3. I'll continue to keep a close eye on this one and update the status here accordingly.

Just thought I'd mention that I'm seeing this error on macOS also. Let me know if I can provide any supporting information, I'd be happy to help.

Hello @maximilliangeorge, I personally use both platforms (MacOS and Windows) and I never encounter it.
Can you provide a log and more details on your setup?

from nuxt-graphql-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.