码迷,mamicode.com
首页 > 其他好文 > 详细

初始化Weex项目遇到的问题记录

时间:2018-12-18 17:17:32      阅读:526      评论:0      收藏:0      [点我收藏+]

标签:back   packages   lis   remove   nts   就是   ges   upd   roi   

Weex 提供了一个命令行工具 weex-toolkit 来帮助开发者使用 Weex。它可以用来快速创建一个空项目、初始化 iOS 和 Android 开发环境、调试、安装插件等操作。

目前 weex-toolkit 只支持创建 Vue.js 的项目。创建 Rax 的项目可以使用 rax-cli,参考 Rax 的官方网站 了解其用法。

初始化

请确保你已经安装了 Node.js (可以参考React Native (0.57)开发环境搭建(过程记录)中Node.js的安装过程)

然后全局安装 weex-toolkit

命令如下:

npm install -g weex-toolkit

但是事与愿违,报错,并且很恶心,怎么搞都没有办法。

解决过程重点记录:

技术分享图片

可能是我使用了左边的推荐的10.14.2版本(记不清了),导致“水土不服”。出现下面的问题:

1、警告

WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/weex-toolkit/node_modules/weex-builder/node_modules/fsevents):

WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 install: `node install`

WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/weex-toolkit/node_modules/weex-previewer/node_modules/fsevents):

2、直接错误:

Tried to download(undefined): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.1.3/fse-v1.1.3-node-v64-darwin-x64.tar.gz 

Pre-built binaries not found for fsevents@1.1.3 and node@10.14.2 (node-v64 ABI, unknown) (falling back to source compile with node-gyp)

ERR! node -v v10.14.2

node-gyp -v v3.8.0

not ok 

build error

node -v v10.14.2

node-pre-gyp -v v0.6.39

not ok 

。。。。

 

就是以上类似问题。

解决方案:

1、降低node的版本号:

npm install -g n

sudo n v8.11.3

       install : node-v8.11.3

       mkdir : /usr/local/n/versions/node/8.11.3

       fetch : https://nodejs.org/dist/v8.11.3/node-v8.11.3-darwin-x64.tar.gz

######################################################################## 100.0%

   installed : v8.11.3

$ node -v

v8.11.3

$ npm -v

5.6.0

安装了node:v8.11.3 版本后,尝试初始化,执行如下命令,并记录过程:

$ npm install weex-toolkit -g

/usr/local/bin/weex -> /usr/local/lib/node_modules/weex-toolkit/bin/weex.js

> fsevents@1.1.3 install /usr/local/lib/node_modules/weex-toolkit/node_modules/weex-builder/node_modules/fsevents

> node install

[fsevents] Success: "/usr/local/lib/node_modules/weex-toolkit/node_modules/weex-builder/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile

> fsevents@1.1.2 install /usr/local/lib/node_modules/weex-toolkit/node_modules/weex-previewer/node_modules/fsevents

> node install

[fsevents] Success: "/usr/local/lib/node_modules/weex-toolkit/node_modules/weex-previewer/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile

> fsevents@1.1.3 install /usr/local/lib/node_modules/weex-toolkit/node_modules/weex-previewer/node_modules/weex-builder/node_modules/fsevents

> node install

[fsevents] Success: "/usr/local/lib/node_modules/weex-toolkit/node_modules/weex-previewer/node_modules/weex-builder/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile

> fsevents@1.1.3 install /usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/node_modules/fsevents

> node install

[fsevents] Success: "/usr/local/lib/node_modules/weex-toolkit/node_modules/xtoolkit/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed

Pass --update-binary to reinstall or --build-from-source to recompile

+ weex-toolkit@1.3.11

added 463 packages and updated 1 package in 22.24s

整个过程没有出现问题

2、升级到最新版本的node.js

接着刚才的去安装最新的node.js

$ brew install node

Warning: node 11.4.0 is already installed, it‘s just not linked

You can use `brew link node` to link this version.

$ brew link node

Linking /usr/local/Cellar/node/11.4.0... 

Error: Could not symlink bin/node

Target /usr/local/bin/node

already exists. You may want to remove it:

  rm ‘/usr/local/bin/node‘

To force the link and overwrite all conflicting files:

  brew link --overwrite node

To list all files that would be deleted:

  brew link --overwrite --dry-run node

果然node版本如下,没有改变:

$ node -v

v8.11.3

$ npm -v

5.6.0

尝试用下面的命令

$ sudo n v11.4.0

$ node -v

v11.4.0

$ npm -v

6.4.1

更新到最新的版本了。

$ npm install weex-toolkit -g

WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I‘ll try to do my best with it!

WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I‘ll try to do my best with it!

WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but npm-shrinkwrap.json was generated for lockfileVersion@0. I‘ll try to do my best with it!

/usr/local/bin/weex -> /usr/local/lib/node_modules/weex-toolkit/bin/weex.js

+ weex-toolkit@1.3.11

updated 229 packages in 20.484s

在最新的版本下面的时候,只剩余警告了。综上所述,我觉的还是使用v8.11.3靠谱点。

初始化Weex项目遇到的问题记录

标签:back   packages   lis   remove   nts   就是   ges   upd   roi   

原文地址:https://www.cnblogs.com/richard-youth/p/10137926.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!