Open TechQuery opened 1 year ago
@jaywcjlove I know what the MVP looks like, and I followed the document's way to configure my project, but it failed with the official error:
info - Creating an optimized production build
Failed to compile.
./node_modules/.pnpm/idea-react@0.26.7_xvmvhqrecqn36a4jhoxc6tew7a/node_modules/idea-react/dist/index.css
Global CSS cannot be imported from within node_modules.
Read more: https://nextjs.org/docs/messages/css-npm
Location: node_modules\.pnpm\idea-react@0.26.7_xvmvhqrecqn36a4jhoxc6tew7a\node_modules\idea-react\dist\index.js
Import trace for requested module:
./node_modules/.pnpm/idea-react@0.26.7_xvmvhqrecqn36a4jhoxc6tew7a/node_modules/idea-react/dist/index.js
./pages/component.tsx
./node_modules/.pnpm/idea-react@0.26.7_xvmvhqrecqn36a4jhoxc6tew7a/node_modules/idea-react/dist/index.css
Module build failed: Error: Final loader (./node_modules/.pnpm/next@12.2.5_sfoxds7t5ydpegc3knd667wn6m/node_modules/next/dist/build/webpack/loaders/error-loader.js) didn't return a Buffer or String
at processResult (D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:57340:17)
at D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:57426:5
at D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:21091:3
at iterateNormalLoaders (D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20917:10)
at iterateNormalLoaders (D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20924:10)
at D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20939:3
at runSyncOrAsync (D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20822:12)
at iterateNormalLoaders (D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20935:2)
at D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:20908:4
at D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\next@12.2.5_sfoxds7t5ydpegc3knd667wn6m\node_modules\next\dist\compiled\webpack\bundle5.js:57400:15
@TechQuery I'm not sure if this is caused by using pnpm
.
Not sure if that solves your problem.
@TechQuery Upgrade v1.0.7
@jaywcjlove Same error, even I reinstall all packages after removing node_modules
& pnpm-lock.yaml
.
I've never used pnpm, so I don't know if it can solve your problem.
I ran it with yarn v1.22.10
and it worked.
@TechQuery
@jaywcjlove I was a Yarn 1.x user, but NPM & Yarn occupied 60GB+ disk space, PNPM saves me.
I tested it with no problem. @TechQuery
I tested it with no problem. @TechQuery
@jaywcjlove http://localhost:3000/component will show you the error.
https://github.com/pnpm/pnpm/issues/991
I've researched it, but I don't think it can be solved. You can refer to other people's solutions.
https://github.com/pnpm/pnpm/search?q=require.resolve&type=issues
@TechQuery
@jaywcjlove https://pnpm.io/npmrc#node-linker mentioned in https://github.com/pnpm/pnpm/issues/991#issuecomment-1120101531 failed to resolve this error too...
@jaywcjlove I roll back to Yarn 1.x, but the error is still there... https://github.com/idea2app/Next-Bootstrap-ts/pull/13/commits/d8fbc7c62ffed6d085b35f805743ec018637ed1c
@TechQuery
- const removeImports = require('next-remove-imports');
+ const removeImports = require('next-remove-imports')();
@jaywcjlove
- const removeImports = require('next-remove-imports'); + const removeImports = require('next-remove-imports')();
It worked in Development mode, but still failed in Building mode:
[BABEL] Note: The code generator has deoptimised the styling of D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\lodash@4.17.21\node_modules\lodash\lodash.js as it exceeds the max of 500KB.
info - Creating an optimized production build
info - Compiled successfully
info - Collecting page data .D:\Work\idea2app\Next-Bootstrap-TS\node_modules\.pnpm\idea-react@0.26.7_xvmvhqrecqn36a4jhoxc6tew7a\node_modules\idea-react\dist\index.umd.css:1
SyntaxError: Unexpected token '.'
> Build error occurred
Error: Failed to collect page data for /component
Code diff is here: https://github.com/idea2app/Next-Bootstrap-ts/pull/13/commits/d2207f814e88be74ad93fc89d67eeabb42696075
Is there a cache problem?
I'm running fine.
@TechQuery
@jaywcjlove It throws a same error after removing .next
folder and re-building.
Vercel building failed as well: https://github.com/idea2app/Next-Bootstrap-ts/runs/7980212322?check_suite_focus=true
So, only Mac OS X works, not Windows & Linux?
@TechQuery I am not sure. I cloned the project again and deleted the cache directory:
rm -rf ~/.pnpm-st*
@jaywcjlove Same error in building after removing .pnpm-store
& re-installing.
Development mode always works while the configuration is correct.
:(
@jaywcjlove Now I roll back to Yarn 1.x or NPM 6.x, React 17/18 type compatibility errors thrown:
Type 'React.ReactNode' is not assignable to type 'import("D:/Work/idea2app/Next-Bootstrap-TS/node_modules/@types/ react-transition-group/node_modules/@types/react/index").ReactNode'.
After I used @ts-ignore
, CSS building error above thrown again...
I think it may be OS Path compatibility problem.
Related Library
https://github.com/idea2app/Idea-React
Reproduce Scaffold
idea2app/Next-Bootstrap-ts#13
Next.js configuration
Environment
@uiwjs