wallabyjs / console-ninja

Repository for Console Ninja questions and issues
https://console-ninja.com
Other
376 stars 17 forks source link

[Bug]: console.log can not show in nextjs #135

Closed tuan-dd closed 1 year ago

tuan-dd commented 1 year ago

What happened?

I new project with next.js , but console.log not working , i run in server, or vite it work normal

image

Version

latest , node 18

Steps to reproduce (or sample repo)

{
  "name": "staymate-nextjs",
  "version": "0.1.0",
  "author": "Tuan",
  "license": "MIT",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "eslint": "eslint ./src/**/*.ts",
    "format": "eslint ./src/**/*.ts --fix"
  },
  "dependencies": {
    "@emotion/cache": "^11.10.7",
    "@emotion/react": "^11.10.6",
    "@emotion/styled": "^11.10.6",
    "@mui/base": "^5.0.0-alpha.126",
    "@mui/icons-material": "^5.11.16",
    "@mui/joy": "^5.0.0-alpha.76",
    "@mui/lab": "^5.0.0-alpha.127",
    "@mui/material": "^5.12.1",
    "@mui/utils": "^5.12.0",
    "@reduxjs/toolkit": "^1.9.5",
    "@types/node": "18.16.0",
    "@types/react": "18.0.38",
    "@types/react-dom": "18.0.11",
    "eslint": "8.39.0",
    "eslint-config-next": "13.3.1",
    "lodash": "^4.17.21",
    "next": "13.3.1",
    "next-redux-wrapper": "^8.1.0",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-redux": "^8.0.5",
    "typescript": "5.0.4",
    "yup": "^1.1.1"
  },
  "devDependencies": {
    "@types/lodash": "^4.14.194",
    "@typescript-eslint/eslint-plugin": "^5.57.0",
    "@typescript-eslint/parser": "^5.57.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-airbnb-typescript": "^17.0.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsx-a11y": "^6.7.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.32.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "prettier": "^2.8.8"
  }
}

Log output

PS C:\Users\tuanp\Desktop\fe-staymate-nextjs>
yarn run dev
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
.link/app-feedback
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
event - compiled client and server successfully in 2.1s (267 modules)
wait  - compiling...
event - compiled client and server successfully in 725 ms (267 modules)
wait  - compiling /page (client and server)...
event - compiled client and server successfully in 5.4s (2369 modules)
run
run
ArtemGovorov commented 1 year ago

Can you please copy and paste your log output from the ~/.console-ninja/trace.log file in your user home directory? Prior to copying, please clear the file, then start Console Ninja on the project and then copy/paste the log.

tuan-dd commented 1 year ago
14:08:26.683 info extension stopping host
14:08:26.697 info host removing cache folder: bf883df14349da3effe677a33d6caecf
14:08:26.709 info buildHook-18760 client disconnected: 1006 
14:08:26.710 info buildHook-12128 client disconnected: 1006 
14:08:26.710 info buildHook-18760 disconnected from host: 52265
14:08:26.710 info buildHook-12128 disconnected from host: 52265
14:08:26.711 info extension client disconnected: 1006 
14:08:26.710 info buildHook-18760 disconnected from all hosts
14:08:26.710 info buildHook-12128 disconnected from all hosts
14:08:26.724 info buildHook-10276 client disconnected: 1006 
14:08:26.725 info buildHook-10276 disconnected from host: 52265
14:08:26.725 info buildHook-10276 disconnected from all hosts
14:08:27.130 info extension host process output: port:[52265]
14:08:27.094 info host ------------ starting ------------
14:08:27.130 info extension 
14:08:27.157 info host client connected: extension { address: '::', family: 'IPv6', port: 52265 }
14:08:27.298 info host starting host: {"extensionFolder":"c:\\Users\\tuanp\\.vscode\\extensions\\wallabyjs.console-ninja-0.0.110","runtimeHookFile":"c:\\Users\\tuanp\\.vscode\\extensions\\wallabyjs.console-ninja-0.0.110\\out\\runtimeHook\\tracer.js","globalErrorHandlerFile":"c:\\Users\\tuanp\\.vscode\\extensions\\wallabyjs.console-ninja-0.0.110\\out\\runtimeHook\\errorHandler.js","filesToInstrument":[{"path":"C:\\Users\\tuanp\\Desktop\\example\\material-next-ts\\material-next-ts\\pages\\_document.tsx"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\material-next-ts\\material-next-ts\\pages\\about.tsx"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\tasks\\collect-issue.task.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\subcribers\\consumer.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\services\\access.service.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\helpers\\check.connect.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\dbs\\init.mongodb.lv0.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\configs\\config.i18n.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\configs\\config.redis.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\controllers\\redis.controller.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\app.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\server.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\auth\\authUtils.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\src\\auth\\checkAuth.js"},{"path":"C:\\Users\\tuanp\\Desktop\\example\\ecommerce-backend\\guides\\cpu-check.js"},{"path":"c:\\Users\\tuanp\\Desktop\\example\\material-next-ts\\material-next-ts\\pages\\about.tsx"},{"path":"c:\\Users\\tuanp\\Desktop\\example\\material-next-ts\\material-next-ts\\pages\\_document.tsx"}],"debug":false,"config":{"dateTimeFormat":"hh:mm:ss.SSS","openLinksInEditor":true,"maxLogViewerEntries":15000,"fontSize":10,"autoClearLogViewerOnFileChanges":true,"outputMode":"Beside File","captureFunctions":false,"enableProFeatures":true,"toolsToAutoPatch":["vite","jest","webpack","next.js","cypress","http-server","serve","nuxt","remix","qwik","hydrogen","live-server","live-preview"]},"allowedHosts":["localhost","127.0.0.1","example.cypress.io","Tuan-dd","192.168.1.33"],"host":"127.0.0.1"}
14:08:27.303 info host worker Starting Host Worker...
14:08:27.316 info host starting tools discovery and integration
14:08:27.324 info host looking for tools to patch
14:08:27.892 info host found 2 tool file(s) to patch
14:08:27.895 info host patching C:\Users\tuanp\Desktop\example\material-next-ts\material-next-ts\node_modules\next\dist\compiled\webpack\bundle5.js
14:08:27.896 info host patching C:\Users\tuanp\Desktop\example\material-next-ts\material-next-ts\node_modules\next\dist\build\webpack\loaders\next-swc-loader.js
14:08:27.955 ERR! host failed to apply build hook related patches: Error: next.js: Error: Expected line 'exports.pitch = pitch;' is not found.; 
14:08:27.961 info host completed tools discovery and integration
14:08:28.222 info buildHook-10276 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.223 info buildHook-10276 running tools: next.js
14:08:28.241 info host client connected: buildHook { address: '::', family: 'IPv6', port: 52265 }
14:08:28.245 info buildHook-10276 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.245 info buildHook-10276 running tools: next.js
14:08:28.331 info buildHook-10276 file processed (stat): 1 log points, error handler: false
14:08:28.347 info buildHook-10276 file processed (stat): 1 log points, error handler: false
14:08:28.539 info buildHook-18760 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.539 info buildHook-18760 running tools: next.js
14:08:28.544 info host client connected: buildHook { address: '::', family: 'IPv6', port: 52265 }
14:08:28.545 info buildHook-18760 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.545 info buildHook-18760 running tools: next.js
14:08:28.573 info buildHook-12128 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.573 info buildHook-12128 running tools: next.js
14:08:28.576 info host client connected: buildHook { address: '::', family: 'IPv6', port: 52265 }
14:08:28.577 info buildHook-12128 allowed tools: vite, jest, webpack, next.js, cypress, http-server, serve, nuxt, remix, qwik, hydrogen, live-server, live-preview, node
14:08:28.577 info buildHook-12128 running tools: next.js
14:08:43.360 ERR! extension host process error: (node:19792) Warning: Closing file descriptor 6 on garbage collection
14:08:43.360 ERR! extension (Use `Code --trace-warnings ...` to show where the warning was created)
14:08:43.360 ERR! extension (node:19792) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.
14:08:43.360 ERR! extension 

in my trace

ArtemGovorov commented 1 year ago

Thanks for reporting the issue. There was a breaking change in the latest next.js version. We have fixed our integration and released the fix in v.0.0.111.

After installing the update, please also delete project's node_modules and .next folders, and run npm i (or yarn if you are using it).

VladislavSmolyanoy commented 1 year ago

Didn’t fix it for me... :(

ArtemGovorov commented 1 year ago

@VladislavSmolyanoy As a check, please try cloning your repo to a fresh folder, start it with Console Ninja running and see if it's working. If it's not working, please create a separate issue using bug template and attach the details requested in te template.

VladislavSmolyanoy commented 1 year ago

@ArtemGovorov Just removing .next and node_modules didn’t fix it. I got it to work by additionally reinstalling the extension 😀

tuan-dd commented 1 year ago

@ArtemGovorov Thank you so much for your kind support, it works fine