Coder Social home page Coder Social logo

安装依赖报错 about vue3-antdv-admin HOT 10 CLOSED

dream-wk avatar dream-wk commented on June 1, 2024
安装依赖报错

from vue3-antdv-admin.

Comments (10)

buqiyuan avatar buqiyuan commented on June 1, 2024

没复现,要不你将 package.json 中的这行:

"postinstall": "node ./scripts/postinstall.js || pnpm nx:build",

改为:

"postinstall": "pnpm build:pkg",

from vue3-antdv-admin.

dream-wk avatar dream-wk commented on June 1, 2024

图片
还是不行

from vue3-antdv-admin.

dream-wk avatar dream-wk commented on June 1, 2024

有没有可能是我的版本问题呢
node是18.19.1
pnpm 8.15.5

from vue3-antdv-admin.

buqiyuan avatar buqiyuan commented on June 1, 2024

版本看起来没问题,按理说你将 postinstall 脚本改为 pnpm build:pkg 之后,就没有执行 nx 相关的命令或脚本了呀🤔

from vue3-antdv-admin.

dream-wk avatar dream-wk commented on June 1, 2024

图片
依赖删了 重新装 还是报错

from vue3-antdv-admin.

buqiyuan avatar buqiyuan commented on June 1, 2024

哦,原理 nx 自己还有个 postinstall 的脚本
image
这样吧!你 pnpm remove nx 卸载掉 nx 这个包。
我 mac 复现不了你的问题,估计可能是电脑环境问题吧!

from vue3-antdv-admin.

buqiyuan avatar buqiyuan commented on June 1, 2024

刚在 nx 官方文档 看了下,可能是这条没满足吧!没关系,你卸载掉 nx 也不影响什么,它只是用来提高 monorepo 构建效率的
image

from vue3-antdv-admin.

dream-wk avatar dream-wk commented on June 1, 2024

图片

from vue3-antdv-admin.

buqiyuan avatar buqiyuan commented on June 1, 2024

插件本身没问题,你可以手动 pnpm build:pkg 构建好相关插件,然后再 pnpm install 应该就可以了。
因为我在 package.json 有如下的配置,pnpm 没有正常同步这两个依赖项,事实上这应该算是 pnpm 官方的 bug,详见此 issue

"dependenciesMeta": {
"@admin-pkg/vite-plugin-msw": {
"injected": true
},
"@admin-pkg/vite-plugin-tinymce-resource": {
"injected": true
}

稍后,我将针对你这个情况做一个降级的处理,项目中 scripts/postinstall.js 这个脚本本身也是为了暂时兼容这个 bug 的
import { promisify } from 'node:util';
import { exec } from 'node:child_process';
// TODO 此脚本用于临时解决:https://github.com/pnpm/pnpm/issues/6088
const execAsync = promisify(exec);
const executeCommand = async (cmd) => {
try {
const { stdout, stderr } = await execAsync(cmd);
console.log('标准输出:', stdout);
stderr && console.error('标准错误:', stderr);
} catch (error) {
console.error('执行命令时出错:', error);
}
};
if (process.env.POSTINSTALL_EXECUTED === 'true') {
// console.log('执行过了');
} else {
// console.log('首次执行');
process.env.POSTINSTALL_EXECUTED = 'true';
await executeCommand('pnpm nx:build');
await executeCommand('pnpm install');
}

from vue3-antdv-admin.

dream-wk avatar dream-wk commented on June 1, 2024

手动 pnpm build:pkg 构建好相关插件,然后再 pnpm install 应该就可以了

还是不行的 一样的报错

from vue3-antdv-admin.

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.