Pake icon indicating copy to clipboard operation
Pake copied to clipboard

pake 命令行打包报 ‘TypeError: url.fileURLToPath is not a function’

Open RekiDunois opened this issue 2 years ago • 7 comments

file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:3234
            const npmDirectory = path.join(path.dirname(url.fileURLToPath(import.meta.url)), '..');
                                                            ^

TypeError: url.fileURLToPath is not a function
    at MacBuilder.<anonymous> (file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:3234:61)
    at Generator.next (<anonymous>)
    at file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:36:71
    at new Promise (<anonymous>)
    at __awaiter (file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:32:12)
    at MacBuilder.build (file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:3219:16)
    at file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:3277:13
    at Generator.next (<anonymous>)
    at fulfilled (file:///~/.config/yarn/global/node_modules/pake-cli/dist/cli.js:33:58)

Node.js v17.8.0

image

cargo 1.65.0 (4bc8f24d3 2022-10-20)

RekiDunois avatar Dec 06 '22 08:12 RekiDunois

目前打包出来代码应该是 fileURLToPath 直接使用,不应该是url.fileURLToPath才对,你这是哪个版本的?可以把cli.js文件和package.json上传下我看看么

wanghanzhen avatar Dec 07 '22 13:12 wanghanzhen

刚发了个0.1.1版本,你试下还会不会

wanghanzhen avatar Dec 07 '22 14:12 wanghanzhen

试着使用 yarn global upgrade pake 升级,升级成功后有如下报错:

pake -V 
node:internal/errors:465
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '~/.config/yarn/global/node_modules/pake-cli/dist/cli.js' imported from ~/.config/yarn/global/node_modules/pake-cli/cli.js
    at new NodeError (node:internal/errors:372:5)
    at finalizeResolution (node:internal/modules/esm/resolve:413:11)
    at moduleResolve (node:internal/modules/esm/resolve:972:10)
    at defaultResolve (node:internal/modules/esm/resolve:1181:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:580:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:294:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:80:40)
    at link (node:internal/modules/esm/module_job:78:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v17.8.0

RekiDunois avatar Dec 09 '22 03:12 RekiDunois

yarn global bin 下面的 pake 安装文件删掉一下再试试呢?

nekomeowww avatar Dec 09 '22 10:12 nekomeowww

@RekiDunois yarn global upgrade pake-cli,包名是 pake-cli

wanghanzhen avatar Dec 10 '22 14:12 wanghanzhen

yarn global bin 下面的 pake 安装文件删掉一下再试试呢?

这个不起作用

@RekiDunois yarn global upgrade pake-cli,包名是 pake-cli

跟这个似乎也无关,改成pake-cli之后还是一样的现象

RekiDunois avatar Dec 10 '22 17:12 RekiDunois

试试npm的方式

tw93 avatar Dec 11 '22 07:12 tw93

  1. 卸载旧的
npm uninstall pake-cli -g
  1. 安装新的。
# 稳定版
npm install -g pake-cli
# 开发版
npm install -g https://github.com/tw93/Pake.git

Tlntin avatar Dec 12 '22 01:12 Tlntin

用了npm之后成功了,感谢。

RekiDunois avatar Dec 12 '22 03:12 RekiDunois