剪贴板无法解析依赖模块

时间:2019-05-13 14:04:17

标签: angular npm

我正在尝试使用剪贴板作为我的有角项目的依赖项。

ERROR in ./node_modules/clipboardy/node_modules/cross-spawn/index.js Module not found: Error: Can't resolve 'child_process' in 'C:\repositories\ui\ui\node_modules\clipboardy\node_modules\cross-spawn' 
ERROR in ./node_modules/clipboardy/node_modules/execa/index.js Module not found: Error: Can't resolve 'child_process' in 'C:\repositories\ui\ui\node_modules\clipboardy\node_modules\execa' 
ERROR in ./node_modules/clipboardy/node_modules/cross-spawn/lib/util/readShebang.js Module not found: Error: Can't resolve 'fs' in 'C:\repositories\ui\ui\node_modules\clipboardy\node_modules\cross-spawn\lib\util' 
ERROR in ./node_modules/isexe/index.js Module not found: Error: Can't resolve 'fs' in 'C:\repositories\ui\ui\node_modules\isexe' 
ERROR in ./node_modules/isexe/windows.js Module not found: Error: Can't resolve 'fs' in 'C:\repositories\ui\ui\node_modules\isexe' 
ERROR in ./node_modules/isexe/mode.js Module not found: Error: Can't resolve 'fs' in 'C:\repositories\ui\ui\node_modules\isexe' 
ERROR in ./node_modules/clipboardy/node_modules/get-stream/buffer-stream.js Module not found: Error: Can't resolve 'stream' in 'C:\repositories\ui\ui\node_modules\clipboardy\node_modules\get-stream'

当我将其添加为开发依赖项并为其添加一些用法时,Angular应用程序不会出现几个错误

import { Component } from '@angular/core';
import * as clipboardy from 'clipboardy';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.sass']
})
export class AppComponent {
  title = 'dummy';
  onInit(){
     clipboardy.read();
  }
}

有什么办法可以解决这个问题?

0 个答案:

没有答案