Node.js 角度导入节点包
我克隆了这个项目: 我想在其中安装另一个模块: 我现在想在angular中使用npm包的函数。它不起作用 我采取的步骤:Node.js 角度导入节点包,node.js,angularjs,npm,module,package,Node.js,Angularjs,Npm,Module,Package,我克隆了这个项目: 我想在其中安装另一个模块: 我现在想在angular中使用npm包的函数。它不起作用 我采取的步骤: npm install ethereum-input-data-decoder Uncaught SyntaxError: Unexpected token { 如果有效的话,我试过了。不 然后,我在TransactionFosController.js文件的第1行添加了导入,因为我想在那里使用新模块 import { InputDataDecoder } from '.
npm install ethereum-input-data-decoder
Uncaught SyntaxError: Unexpected token {
如果有效的话,我试过了。不
然后,我在TransactionFosController.js文件的第1行添加了导入,因为我想在那里使用新模块
import { InputDataDecoder } from '../../ethereum-input-data-decoder';
程序部分崩溃,出现错误:
npm install ethereum-input-data-decoder
Uncaught SyntaxError: Unexpected token {
我意识到我导入的节点包不正确
但从克隆的git repo的文件结构来看,我看不到另一个可以导入包的文件
我需要将导入放置在何处/我需要创建哪个文件
编辑:AngularJS需要答案你能试试这个吗:
import * as inputDataDecoder from 'ethereum-input-data-decoder'
<script src='path_to_node_modules/ethereum-input-data-decoder'></script>
或者正如托尼指出的那样
import InputDataDecoder as inputDataDecoder from 'ethereum-input-data-decoder'
如果您正在使用angularjs,请尝试以下操作:
import * as inputDataDecoder from 'ethereum-input-data-decoder'
<script src='path_to_node_modules/ethereum-input-data-decoder'></script>
您是否在NodeJS中使用
以太坊输入数据解码器
软件包???我通过npm安装以太坊输入数据解码器尝试使其在Angular中工作,不建议这样做。如果您查看,Import*将把所有内容导入应用程序inputDataDecoder
是唯一作为模块导出的东西,所以我想这很好。或者,*
可以替换为InputDataDecoder
我需要把它放在哪里?我能把它放在1号线上吗?是的,我猜在第1行我得到了未捕获的语法错误:意外标识符