Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: modern build failed on windows10 but work successfully on windows11 and macOS #4883

Closed
AuglyXu opened this issue Oct 30, 2023 · 15 comments
Assignees
Labels
bug Something isn't working

Comments

@AuglyXu
Copy link

AuglyXu commented Oct 30, 2023

Version

System: windows10
version: 2.39.0

Details

我的配置如下:
import { moduleTools, defineConfig } from '@modern-js/module-tools';

export default defineConfig({
buildConfig: [
{
format: 'cjs',
target: 'es6',
buildType: 'bundleless',
outDir: './build/lib',
sideEffects: [/.css$/],
dts: false,
/** 只需拷贝一次即可 */
copy: {
patterns: [
{
from: 'package.json',
context: __dirname,
to: './../package.json',
},
],
},
},
{
format: 'esm',
target: 'es6',
buildType: 'bundleless',
outDir: './build/es',
sideEffects: [/.css$/],
dts: false,
},
],
plugins: [moduleTools()],
});

Reproduce link

base config enough

Reproduce Steps

image
image

@AuglyXu AuglyXu added the bug Something isn't working label Oct 30, 2023
@chenjiahan
Copy link
Member

@10Derozan Please check this

@10Derozan
Copy link
Contributor

重装依赖可以解决吗

@AuglyXu
Copy link
Author

AuglyXu commented Oct 31, 2023

重装依赖可以解决吗

解决不了诶

@10Derozan
Copy link
Contributor

我理解这是本地环境的问题吧,可以提供一些解答么?感谢@HerringtonDarkholme

@fengjiling123
Copy link

@10Derozan 把buildType: 'bundleless'改成buildType: 'bundle'就好了,麻烦看一下为什么bundleless会报这个错

@fengjiling123
Copy link

fengjiling123 commented Nov 1, 2023

@10Derozan 把demo的配置改成npm-component也会报这个错
image

@HerringtonDarkholme
Copy link

Hey @AuglyXu can you list the content inside node_modules of @ast-grep. Probably we need all directories inside there.

@HerringtonDarkholme
Copy link

I can see napi's node binding in the npm package. Is it caused by pnpm + windows?
image

@AuglyXu
Copy link
Author

AuglyXu commented Nov 1, 2023

I can see napi's node binding in the npm package. Is it caused by pnpm + windows? image

image
Is this what you want to see?
It is caused by pnpm + windows.

@HerringtonDarkholme
Copy link

@AuglyXu can you try these commands in a new project? https://ast-grep.github.io/guide/api-usage.html

pnpm add @ast-grep/napi
import { js } from '@ast-grep/napi';

const source = `console.log("hello world")`
const ast = js.parse(source)
const node = ast.root().find('console.log')

If the code example works, I would speculate the problem is pnpm.

@HerringtonDarkholme
Copy link

@AuglyXu I think there is some issues in your deps.

pnpm is finding ast-grep/napi 0.12.0

image

while modern only installs 0.1.13

image

@AuglyXu
Copy link
Author

AuglyXu commented Nov 2, 2023

@AuglyXu I think there is some issues in your deps.

pnpm is finding ast-grep/napi 0.12.0

image

while modern only installs 0.1.13

image

Thank you @HerringtonDarkholme .Actually it not append on my computer, it's my partner's computer happened.My partner firmly believe that I pasted the wrong picture and she proposed the new issue https://github.com/web-infra-dev/modern.js/issues/4900, so she unwilling to try and i'm also distressed.She say may be you can position from the new picture.Does she need to run the above code or you can position the question combined the two pictures?

@10Derozan
Copy link
Contributor

@10Derozan 把buildType: 'bundleless'改成buildType: 'bundle'就好了,麻烦看一下为什么bundleless会报这个错

bundleless 的场景我才会用 ast-grep 做一些例如别名替换的操作

@10Derozan
Copy link
Contributor

I recommend you can follow the steps below:

  1. Check the package version. Now modern.js use [email protected], please use the latest modern.js and reinstall.
  2. Then check the node_modules, you had better add a screenshot about @ast-grep in node_modules.
  3. If the version is right, and win32-x64-msvc.node exist, use ast-grep directly, and follow the tips, check the same error or not.

It doesn't look like it's an ast grep problem. If you can not reappear, i'll close this issue two days later

@AuglyXu I think there is some issues in your deps.
pnpm is finding ast-grep/napi 0.12.0
image
while modern only installs 0.1.13
image

Thank you @HerringtonDarkholme .Actually it not append on my computer, it's my partner's computer happened.My partner firmly believe that I pasted the wrong picture and she proposed the new issue https://github.com/web-infra-dev/modern.js/issues/4900, so she unwilling to try and i'm also distressed.She say may be you can position from the new picture.Does she need to run the above code or you can position the question combined the two pictures?

@10Derozan
Copy link
Contributor

Ok ,fine, i found another issue the same with this, switch there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants