truffle填坑指南:truffle unbox react项目npm run start启动失败
目录
背景
解决方法
后记
背景
因为我安装的环境是比较新的,所以命令什么的都有点区别。
hisee@liu:~$ truffle -version
Truffle v4.1.14 - a development framework for Ethereum
hisee@liu:~$ npm --version
6.4.1
当我truffle unbox react
hisee@liu:~/react-demo2$ truffle unbox react
Downloading...
Unpacking...
Setting up...
Unbox successful. Sweet!Commands:Compile: truffle compileMigrate: truffle migrateTest contracts: truffle testTest dapp: cd client && npm testRun dev server: cd client && npm run startBuild for production: cd client && npm run build
hisee@liu:~/react-demo2$ ls
tuffle develop -> compile -> migrate -> npm run start(或者 npm start)时,报如下错误,或者其他乱七八糟的错误,要么说npm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR!
hisee@liu:~/react-demo2$ npm run start> ganache-cli@6.1.8 start /home/hisee/react-demo2
> ./build/cli.node.jssh: 1: ./build/cli.node.js: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! ganache-cli@6.1.8 start: `./build/cli.node.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the ganache-cli@6.1.8 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /home/hisee/.npm/_logs/2018-10-09T02_08_31_458Z-debug.log
或者
hisee@liu:~/react-demo2$ npm start
npm ERR! path /home/hisee/react-demo2/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/hisee/react-demo2/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent npm ERR! A complete log of this run can be found in:
npm ERR! /home/hisee/.npm/_logs/2018-10-09T03_04_02_262Z-debug.log
hisee@liu:~/react-demo2$
问题就出在命令不对
重新或者新建项目后,执行如下步骤(tuffle develop -> compile -> migrate ->test)
hisee@liu:~/react-demo2$ truffle develop
Truffle Develop started at http://127.0.0.1:9545/Accounts:
(0) 0x627306090abab3a6e1400e9345bc60c78a8bef57
(1) 0xf17f52151ebef6c7334fad080c5704d77216b732
(2) 0xc5fdf4076b8f3a5357c5e395ab970b5b54098fef
(3) 0x821aea9a577a9b44299b9c15c88cf3087f3b5544
(4) 0x0d1d4e623d10f9fba5db95830f7d3839406c6af2
(5) 0x2932b7a2355d6fecc4b5c0b6bd44cc31df247a2e
(6) 0x2191ef87e392377ec08e7c08eb105ef5448eced5
(7) 0x0f4f2ac550a1b4e2280d04c21cea7ebd822934b5
(8) 0x6330a553fc93768f612722bb8c2ec78ac90b3bbc
(9) 0x5aeda56215b167893e80b4fe645ba6d5bab767dePrivate Keys:
(0) c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
(1) ae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
(2) 0dbbe8e4ae425a6d2687f1a7e3ba17bc98c673636790f1b8ad91193c05875ef1
(3) c88b703fb08cbea894b6aeff5a544fb92e78a18e19814cd85da83b71f772aa6c
(4) 388c684f0ba1ef5017716adb5d21a053ea8e90277d0868337519f97bede61418
(5) 659cbb0e2411a44db63778987b1e22153c086a95eb6b18bdf89de078917abc63
(6) 82d052c865f5763aad42add438569276c00d3d88a2d062d36b2bae914d58b8c8
(7) aa3680d5d48a8283413f7a108367c7299ca73f553735860a87b08f39395618b7
(8) 0f62d96d6675f32685bbdb8ac13cda7c23436f63efbb9d07700d8669ff12b7c4
(9) 8d5366123cb560bb606379f90a0bfd4769eecc0557f1b362dcae9012b548b1e5Mnemonic: candy maple cake sugar pudding cream honey rich smooth crumble sweet treat⚠️ Important ⚠️ : This mnemonic was created for you by Truffle. It is not secure.
Ensure you do not use it on production blockchains, or else you risk losing funds.truffle(develop)> compile
Compiling ./contracts/Migrations.sol...
Compiling ./contracts/SimpleStorage.sol...
Writing artifacts to ./build/contractstruffle(develop)> migrate
Using network 'develop'.Running migration: 1_initial_migration.jsDeploying Migrations...... 0x661a01f16a8bd453c93a87a4e1576346c7457ff4102fa8ecc8a3f894cabc7279Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0
Saving successful migration to network...... 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956
Saving artifacts...
Running migration: 2_deploy_contracts.jsDeploying SimpleStorage...... 0xa55ceb18cdd8956da5329be84ad15c6ae4ffefe97a1e2c0c62f790bc0f9782baSimpleStorage: 0x345ca3e014aaf5dca488057592ee47305d9b3e10
Saving successful migration to network...... 0xf36163615f41ef7ed8f4a8f192149a0bf633fe1a2398ce001bf44c43dc7bdda0
Saving artifacts...
truffle(develop)> test
Using network 'develop'.Compiling ./contracts/SimpleStorage.sol...
Compiling ./test/TestSimpleStorage.sol...
Compiling truffle/Assert.sol...
Compiling truffle/DeployedAddresses.sol...TestSimpleStorage✓ testItStoresAValue (43ms)Contract: SimpleStorage✓ ...should store the value 89.2 passing (471ms)truffle(develop)>
解决方法
再新建命令窗口:执行 cd client && npm run start ,不是npm run start!!!
结果如下,启动成功。
后记
1、如果出现如下错误,执行下方命令进行添加。
Module not found: Can't resolve 'bignumber.js' in '/home/hisee/react-demo2/client/node_modules/truffle-contract/lib'
npm install --save bignumber.js
2、上面的页面是非正常显示,如需知道解决方法,请移步这篇文章。
https://blog.csdn.net/u010689354/article/details/83118301
truffle填坑指南:truffle unbox react项目npm run start启动失败相关推荐
- react项目 npm run eject报错
react项目,执行npm run eject生成配置文件报错: Remove untracked files, stash or commit any changes, and try again. ...
- 开发工具总结(4)之Android Studio3.0填坑指南
序言 Android Studio 3.0 上篇讲了: 全面总结Android Studio2.X的填坑指南 这篇讲一下AS3.0的坑.. 作为这个世界上走在最前沿的生物"猿",怎 ...
- alert点击确定后跳转_公众号/h5 跳转到小程序填坑指南
公众号/h5 跳转到小程序填坑指南 本文介绍的是使用微信开放标签 wx-open-launch-weapp 实现微信浏览器内网页跳转到任意合法合规的小程序里,官方要求微信版本为:7.0.12 及以上, ...
- 开发工具总结(2)之全面总结Android Studio2.X的填坑指南
前言:好多 Android 开发者都在说Android Studio太坑了,老是出错,导致开发进度变慢,出错了又不知道怎么办,网上去查各种解决方案五花八门,有些可以解决问题,有些就是转来转去的写的很粗 ...
- KKBOX音乐——数据分析,用户研究与填坑指南
KKBOX音乐--数据分析,用户研究与填坑指南 导语 1 数据来源 2 数据处理 2.1 录入数据 2.2 数据类型 3 探索性分析 3.1 MySQL+Excel 3.1.1 每年3月最先注册的前1 ...
- Redmine3.3.3 搭建与不完全填坑指南
为什么80%的码农都做不了架构师?>>> Redmine3.3.3 搭建与不完全填坑指南 [TOC] 概要 Redmine3.3.3 搭建.不完全填坑指南.不联网安装.Wind ...
- Android Studio 填坑指南
前几天发布了一篇名为<Android Studio 安装.配置及第一个程序演示>的博文,有不少童鞋都认真阅读过并照步骤一步一步操作了一遍,有滴如期成功地装好了,然鹅有滴反映说这不对呀,为森 ...
- 第二篇:salt-api使用填坑指南
前言 salt-api在使用时,有些坑欲哭无泪,一路趟雷过后,总结了一趟salt-pai使用填坑指南,保君一路畅通. salt-api 安装 #本文的安装版本 2018.3.2-1.el6 yum i ...
- NW.JS填坑指南(解决Flash插件、视频播放等故障)
目录 NW.JS填坑指南 NW.js是什么? NW.js 和 electron的选择 开发工具IDE 下载nwjs 版本信息 简单的实例 改图标 改合成exe的图标 改图标第二种方案是 播放不了视频 ...
最新文章
- RPA实施过程中可能会遇到的14个坑
- 利用 Python 打造一个语音合成系统
- 【周末阅读】10年内,19个关键技术将改变世界
- matlab怎么实现拖音,请问M8190A怎么通过Matlab实现多音调
- 程序人生:32条软件开发的建议和教训,值得读一读!
- WordPress 主题教程 #4b:Header 模板 2
- DDD(Domain-Driven Design)领域驱动设计-(二)事件风暴
- CONTEXT_CREATION_ERROR: Renderer: Error creating Canvas3D graphics context/Not a GL2 implementation
- 线性代数基本公式结论简要总结(1)
- arduino GPS 经纬度解析(C语言)
- C语言枚举类型和联合体
- 苹果开发者账号变更公司名称
- shader从入门到精通——(二)三大主流编程语言
- ffmpeg linux 升级_linux系统部署ffmpeg视频转码环境及使用方法 | linux系统运维
- Spring AOP 学习总结
- WOT 2017会议嘉宾名单提前看!
- 谷歌adwords教程_区块链技术作为Google AdWords中的安全剧院
- Java SWT的Composite控件刷新
- 软件研发类应届毕业生培养考核的三个阶段
- 工行华虹U盾在Vista和IE7下的解决方案