Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
375 views
in Technique[技术] by (71.8m points)

weex最新版如何将.vue编译成.js文件

参考官方教程

安装了weex脚手架工具。

sudo cnpm install -g weex-toolkit

都成功了,nodejs是v6.10.1, npm是3.10.10,都是最新版本

可是只能使用weex init命令
我用weex compile src/foo.vue却报错。
直接输入weex回车也报同样的错

/usr/local/lib/node_modules/weex-toolkit/node_modules/[email protected]@xtoolkit/src/package/NpmPackage.js:50
                throw new Error('resolve path error:'+this.path)
                ^

Error: resolve path error:/usr/local/lib/node_modules/weex-toolkit/node_modules/._weex-previewer
    at NpmPackage.resolve (/usr/local/lib/node_modules/weex-toolkit/node_modules/[email protected]@xtoolkit/src/package/NpmPackage.js:50:23)
    at Command.run (/usr/local/lib/node_modules/weex-toolkit/node_modules/[email protected]@xtoolkit/src/Command.js:43:13)
    at XToolkit._done (/usr/local/lib/node_modules/weex-toolkit/node_modules/[email protected]@xtoolkit/src/xtoolkit.js:149:36)
    at process.nextTick (/usr/local/lib/node_modules/weex-toolkit/node_modules/[email protected]@xtoolkit/src/xtoolkit.js:90:22)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
    at Module.runMain (module.js:606:11)
    at run (bootstrap_node.js:393:7)
    at startup (bootstrap_node.js:150:9)
    at bootstrap_node.js:508:3

弄了一天,实在没办法了,来求助各位大神。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你重新安装一下吧,

npm uninstall -g weex-toolkit
npm install weex-toolkit -g

不要建议用户用 sudo 安装 npm的一些模块,一是权限的连带性不好,而是确实后面影响一些文件执行。关于如何取消 mac npm 取消 sudo 可以看这里


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...