1.安装nodejs
2.在cmd中
npm install -g remix-ide
3.直接在cmd中
remix-ide
从这一步开始各种报错
我安装的版本是0.10.3
(这里可以查版本,必要时可以回退)
https://www.npmjs.com/package/remix-ide
运行的时候
第一个报错的问题是:
缺少remixd的包
Error: Cannot find module 'remixd'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (C:\Users\xcp\AppData\Roaming\npm\node_modules\remix-ide\bin\remix-ide:4:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
手动安装失败后,发现这个包,还会暴另一个错误
这个错误就是remix作者的笔误了(nmd怎么回事。。)
remixd.Router is not a constructor
remixd的用法搞错了
C:\Users\xcp\AppData\Roaming\npm\node_modules\remix-ide\bin\remix-ide:13
var router = new remixd.Router(65520, remixd.services.sharedFolder, { remixIdeUrl: 'http://localhost:8080' }, (webSocket) => {
^
TypeError: remixd.Router is not a constructor
at Object. (C:\Users\xcp\AppData\Roaming\npm\node_modules\remix-ide\bin\remix-ide:13:14)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
由于我的没时间进一步研究这个代码,只知道这个包的主要作用是方便导入文件,因此直接屏蔽
相关代码,
在C:\Users\xcp\AppData\Roaming\npm\node_modules\remix-ide\bin文件中去除关于remixd的内容
#去除之前
#!/usr/bin/env node
var path = require('path')
var httpServer = require('http-server')
var remixd = require('remixd')
var server = httpServer.createServer({
root: path.join(__dirname, '/../')
})
var folder = process.argv.length > 2 ? process.argv[2] : process.cwd()
server.listen(8080, '127.0.0.1', function () {})
var router = new remixd.Router(65520, remixd.services.sharedFolder, { remixIdeUrl: 'http://localhost:8080' }, (webSocket) => {
remixd.services.sharedFolder.setWebSocket(webSocket)
remixd.services.sharedFolder.setupNotifications(folder)
remixd.services.sharedFolder.sharedFolder(folder, false)
})
router.start()
console.log('\x1b[33m%s\x1b[0m', 'Starting Remix IDE at http://localhost:8080 and sharing ' + folder)
#去除之后
#!/usr/bin/env node
var path = require('path')
var httpServer = require('http-server')
var server = httpServer.createServer({
root: path.join(__dirname, '/../')
})
var folder = process.argv.length > 2 ? process.argv[2] : process.cwd()
server.listen(8080, '127.0.0.1', function () {})
console.log('\x1b[33m%s\x1b[0m', 'Starting Remix IDE at http://localhost:8080 and sharing ' + folder)
能正常运行了
http://localhost:8080
访问该网页,出现
“该网页无法正常运作”
的错误
查询后发现是http-server的包太新的原因
主动回退
npm install -g [email protected]
因为下载了全局的包,所以要把原来remix中在
C:\Users\xcp\AppData\Roaming\npm\node_modules\remix-ide\node_modules
的文件夹中把http-server删掉
#############################################
换一种方式装
1.在下载的时候命令改为
npm install -g [email protected] --ingore script
@0.9.4 可以改为更低版本,高本版该方法不适用
(直接启动会暴scrypt的错误)
2.在\remix-ide\node_modules\scrypt 中找到index.js 将其中的require("./build/Release/scrypt")改为
require(“scrypt”)
npm install -g [email protected]
在\remix-ide\node_modules中删掉http-server(同之前的方法)