vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.02k stars 26.99k forks source link

Lint failing #28352

Closed lorensr closed 3 years ago

lorensr commented 3 years ago

What version of Next.js are you using?

canary@a0f64ba

What version of Node.js are you using?

16.6.2

What browser are you using?

n/a

What operating system are you using?

macOS 11.4

How are you deploying your application?

n/a

Describe the Bug

When I run npm run lint, I get exit code 2 with this output:

``` test/test-file.txt: no issues found examples/cms-sanity/lib/sanity.js examples/custom-server-hapi/next-wrapper.js examples/with-draft-js/pages/index.js examples/with-fauna/pages/index.js examples/with-msw/mocks/handlers.js lerna ERR! yarn run typescript exited 2 in 'next' examples/with-prisma/README.mdlerna ERR! yarn run typescript stdout: yarn run v1.22.5 $ tsc --noEmit --declaration build/webpack/plugins/next-trace-entrypoints-plugin.ts(2,10): error TS2305: Module '"next/dist/compiled/@vercel/nft"' has no exported member 'nodeFileTrace'. build/webpack/plugins/next-trace-entrypoints-plugin.ts(2,31): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export. server/render.tsx(1014,29): error TS7006: Parameter 'observer' implicitly has an 'any' type. server/render.tsx(1264,26): error TS2503: Cannot find namespace 'ZenObservable'. server/render.tsx(1266,21): error TS2503: Cannot find namespace 'ZenObservable'. server/render.tsx(1270,10): error TS7006: Parameter 'chunk' implicitly has an 'any' type. server/render.tsx(1274,11): error TS7006: Parameter 'error' implicitly has an 'any' type. server/render.tsx(1290,26): error TS7006: Parameter 'observer' implicitly has an 'any' type. server/send-payload.ts(124,54): error TS7006: Parameter 'chunk' implicitly has an 'any' type. types/misc.d.ts(191,17): error TS2307: Cannot find module '@vercel/nft' or its corresponding type declarations. types/misc.d.ts(227,17): error TS2307: Cannot find module 'zen-observable' or its corresponding type declarations. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. lerna ERR! yarn run typescript stderr: error Command failed with exit code 2. lerna ERR! yarn run typescript exited 2 in 'next' examples/with-react-bootstrap/README.mdERROR: "lint-typescript" exited with 2. ```

Expected Behavior

Exit code 0

To Reproduce

npm run lint on latest canary, a0f64ba.

ijjk commented 3 years ago

Hi, it looks like you're running lint on the Next.js repo itself before the prepublish step has finished so it's expected to fail since the types aren't generated until this step has been complete.

lorensr commented 3 years ago

I get the same error running npm run prepublish:

[11:02:41] Finished release in 6.42s
$ tsc --declaration --emitDeclarationOnly --declarationDir dist
build/webpack/plugins/next-trace-entrypoints-plugin.ts(2,10): error TS2305: Module '"next/dist/compiled/@vercel/nft"' has no exported member 'nodeFileTrace'.
build/webpack/plugins/next-trace-entrypoints-plugin.ts(2,31): error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.
server/render.tsx(1014,29): error TS7006: Parameter 'observer' implicitly has an 'any' type.
server/render.tsx(1264,26): error TS2503: Cannot find namespace 'ZenObservable'.
server/render.tsx(1266,21): error TS2503: Cannot find namespace 'ZenObservable'.
server/render.tsx(1270,10): error TS7006: Parameter 'chunk' implicitly has an 'any' type.
server/render.tsx(1274,11): error TS7006: Parameter 'error' implicitly has an 'any' type.
server/render.tsx(1290,26): error TS7006: Parameter 'observer' implicitly has an 'any' type.
server/send-payload.ts(124,54): error TS7006: Parameter 'chunk' implicitly has an 'any' type.
types/misc.d.ts(191,17): error TS2307: Cannot find module '@vercel/nft' or its corresponding type declarations.
types/misc.d.ts(227,17): error TS2307: Cannot find module 'zen-observable' or its corresponding type declarations.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
lerna ERR! yarn run prepublish stderr:
error Command failed with exit code 2.
error Command failed with exit code 2.
lerna ERR! yarn run prepublish exited 2 in 'next'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! nextjs-project@ prepublish: `lerna run prepublish`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the nextjs-project@ prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2021-08-21T15_03_02_132Z-debug.log
ijjk commented 3 years ago

Hmm it looks like not all packages are installed, are you using yarn for the initial install for the monorepo?

ijjk commented 3 years ago

Closing per above, feel free to respond with additional info if this is still an issue.

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.