【发布时间】:2018-10-12 06:59:19
【问题描述】:
我是日本初学者的网络开发者。
而且我英语不好。
对不起。
我想使用这个模块。
https://www.npmjs.com/package/unzip
所以我做了yarn add unzip 和yarn add fs 和yarn add module v8 和yarn add request@2.79.0。
我做到了
var fs = require('fs');
var unzip = require('unzip');
但是因为 "require('unzip')" ,我得到了错误。
未捕获的错误:没有这样的模块。 (可能尚未加载)
我在构建时遇到了这个错误。
WARNING 编译时有 3 个警告 16:03:20
./node_modules/natives/index.js 中的警告
关键依赖:依赖的请求是一个表达式
./node_modules/lazy-debug-legacy/src/functions.js 中的警告
关键依赖:依赖的请求是一个表达式
警告在./node_modules/lazy-debug-legacy/src/functions.js
关键依赖:依赖的请求是一个表达式
有人告诉我解决这个问题的方法吗? 我不能使用解压缩模块。
我也用过这个模块。
https://www.npmjs.com/package/unzipper
如果我这样做了
var unzipper = require('unzipper');
我得到了不同的错误。
polyfills.js?a0a3:32 Uncaught TypeError: Cannot read property 'match' 未定义的
我的完整代码。
//converter.ts
var fs = require('fs');
var unzipper = require('unzipper');
export default function converter(file) {
console.log(file)
// fs.createReadStream(file)
// .pipe(unzipper.Extract({ path: './tmp/' }));
}
//convert.vue
<template>
<div class="convert">
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import converter from "./converter"
@Component({
components: {}
})
export default class Convert extends Vue {
mounted(){
converter("./resources/text.zip")
}
}
</script>
<style lang="scss">
</style>
【问题讨论】:
-
你的英文还可以,但如果你觉得你更喜欢用日文写作,你可以查看ja.stackoverflow.com。
-
谢谢。但是这里有更好的开发者(T____T)
-
node --version说什么?你是用yarn add unzip还是npm i -S unzip添加的? -
node -v 是“v9.5.0”,我添加了纱线!!!我正在使用 vue-cli3.0。
-
您正在尝试在浏览器 (Vue.js) 中使用该库?
标签: javascript typescript yarnpkg