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

fs-extra 模块不能正常使用 #4732

Closed
pxim opened this issue Aug 10, 2021 · 13 comments
Closed

fs-extra 模块不能正常使用 #4732

pxim opened this issue Aug 10, 2021 · 13 comments

Comments

@pxim
Copy link

pxim commented Aug 10, 2021

What happens?

https://github.com/jprichardson/node-fs-extra
这个模块在egg里用不了,

How To Reproduce

Steps to reproduce the behavior:
1.
image
一旦添加红框中的代码,运行dev,直接报错
image

  1. 去掉红框里的代码,运行dev,就ok正常。

  2. package.json
    { "private": true, "version": "1.5.1", "description": "Preview glTF models using three.js and a drag-and-drop interface.", "author": "Don McCurdy <[email protected]> (https://www.donmccurdy.com)", "license": "MIT", "main": "public/app.js", "proxy": "http://127.0.0.1:801", "targets": { "main": { "engines": { "browsers": [ "> 1%", "not dead" ] } } }, "staticFiles": { "staticPath": [ { "staticPath": "assets", "staticOutDir": "assets" } ] }, "scripts": { "build": "parcel public index.html --public-url . --out-dir public", "build:registry": "curl https://rawgit.com/KhronosGroup/glTF-Generator-Registry/master/registry.json -o lib/gltf-generator-registry.json", "dev": "parcel index.html --port 3000", "test": "node scripts/gen_test.js", "deploy": "npm run build && vercel --local-config vercel.json --prod", "postversion": "git push && git push --tags" }, "dependencies": { "axios": "^0.21.1", "can": "^6.6.1", "dat.gui": "^0.7.7", "glob-to-regexp": "^0.4.1", "glsl-blend-soft-light": "^1.0.5", "glsl-film-grain": "^1.0.4", "gltf-validator": "^2.0.0-dev.3.3", "handlebars": "^4.7.6", "jquery": "^3.6.0", "query-string": "^7.0.0", "simple-dropzone": "^0.8.1", "three": "^0.129.0" }, "devDependencies": { "glslify-bundle": "^5.1.1", "glslify-deps": "^1.3.2", "node-fetch": "^2.6.1", "parcel-bundler": "^1.12.4", "parcel-plugin-static-files-copy": "^2.5.0" } }

Expected behavior
1.
2.

Context

  • Node Version: v14.15.0
  • Egg Version: ^2.15.1
  • Plugin Name: node-fs-extra
  • Plugin Version: ^10.0.0
  • Platform: win10
@pxim pxim changed the title fs-extra fs-extra 模块不能正常使用 Aug 10, 2021
@atian25
Copy link
Member

atian25 commented Aug 10, 2021

跟 egg 没什么关系,报错堆栈都打印出来了,自己断点查查

@pxim
Copy link
Author

pxim commented Aug 10, 2021

跟 egg 没什么关系,报错堆栈都打印出来了,自己断点查查

我业务代码其他都没问题,除了引用下这个库;这个库7.9kstar,我新建一个基础的nodejs项目用的话,也没啥问题;

@atian25
Copy link
Member

atian25 commented Aug 10, 2021

请提供一个最小可复现代码库,提供后可以 reopen 本 issue

@hyj1991 hyj1991 closed this as completed Aug 10, 2021
@pxim
Copy link
Author

pxim commented Aug 10, 2021

请提供一个最小可复现代码库,提供后可以 reopen 本 issue

https://drive.google.com/file/d/1Je_eyR-AlXGOIfWW8-zdQO1GJg7ffrsf/view?usp=sharing

fs-extra 在 app controller editor project里
运行 dev,有 const fse = require('fs-extra'); 就报错,没有就正常

@egg-bot
Copy link

egg-bot commented Aug 10, 2021

Hello @pxim. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@pxim,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

@atian25
Copy link
Member

atian25 commented Aug 10, 2021

按这个来,提交到 GitHub 个人仓库

@pxim
Copy link
Author

pxim commented Aug 10, 2021

按这个来,提交到 GitHub 个人仓库

https://github.com/pxim/res-web3d-editor-server-egg-pkg

@atian25
Copy link
Member

atian25 commented Aug 10, 2021

复现方式?

@pxim
Copy link
Author

pxim commented Aug 10, 2021

复现方式?

  1. npm install
  2. npm run dev
  3. 控制台出错

@atian25
Copy link
Member

atian25 commented Aug 10, 2021

试了,是正常的。

看到你的依赖有 pkg 打包的,怀疑跟它有关,你可以试着 rm 掉 node_modules 后再试试。

@pxim
Copy link
Author

pxim commented Aug 10, 2021

试了,是正常的。

看到你的依赖有 pkg 打包的,怀疑跟它有关,你可以试着 rm 掉 node_modules 后再试试。

我用egg-examples里的案例测试是正常的,但是在我项目环境里出错;

我 删掉 node_modules ,然后又重新安装了,还是不行;算了,我不用这个库了;

@atian25
Copy link
Member

atian25 commented Aug 10, 2021

提供不了稳定复现方式,我们也没法解决。

从原理上来想都不可能跟 egg 有关,而且错误堆栈都出来了,其实你断点下几分钟就能知道问题了。

我猜测大概率跟 pkg 构建的产物干扰有关。

@pxim
Copy link
Author

pxim commented Aug 13, 2021

提供不了稳定复现方式,我们也没法解决。

从原理上来想都不可能跟 egg 有关,而且错误堆栈都出来了,其实你断点下几分钟就能知道问题了。

我猜测大概率跟 pkg 构建的产物干扰有关。

我用egg init新建了一个工程,然后把pkg的配置原样拷过去,业务代码拷过去,fs-extra 可以正常使用了,其他功能也都正常;

至于为什么以前的不能用,就不清楚了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants