【问题标题】:Problems running MERN tests运行 MERN 测试的问题
【发布时间】:2016-11-14 04:30:50
【问题描述】:

我正在考虑将 MERN 框架用于一个新项目,但到目前为止,我对所看到的内容并不感到鼓舞。我已按照通过mern-cli 设置项目的说明进行操作,并且该项目确实已创建并且确实运行正常,但是当我执行时...

npm run test

我明白了……

> mern-starter@2.0.0 test /Users/acooley/workspace/node_datacenter
> cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava

/usr/local/Cellar/node/7.1.0/bin/node: bad option: --harmony-proxies
----------|----------|----------|----------|----------|----------------| File      |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
----------|----------|----------|----------|----------|----------------|
----------|----------|----------|----------|----------|----------------| All files |      100 |      100 |      100 |      100 |                |
----------|----------|----------|----------|----------|----------------|


npm ERR! Darwin 16.1.0 npm ERR! argv "/usr/local/Cellar/node/7.1.0/bin/node" "/usr/local/bin/npm" "run" "test" npm ERR! node v7.1.0 npm ERR! npm  v3.10.9 npm ERR! code ELIFECYCLE npm ERR! mern-starter@2.0.0 test: `cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava` npm ERR! Exit status 9 npm ERR!  npm ERR! Failed at the mern-starter@2.0.0 test script 'cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the mern-starter package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR!     cross-env NODE_ENV=test PORT=8080 MONGO_URL=mongodb://localhost:27017/mern-test node_modules/.bin/nyc node --harmony-proxies node_modules/.bin/ava npm ERR! You can get information on how to open an issue for this project with: npm ERR!    npm bugs mern-starter npm ERR! Or if that isn't available, you can get their info via: npm ERR!     npm owner ls mern-starter npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR!     /Users/acooley/workspace/node_datacenter/npm-debug.log

还有其他人遇到过这种情况吗?我真的很想使用这个框架,但是没有功能性的 TDD 是一个阻碍。

【问题讨论】:

    标签: node.js reactjs mern


    【解决方案1】:

    在节点 v6+ 上运行 MERN 2.0(当前最新版本)的测试用例失败。以下是我为在 OS X 上运行测试所做的工作:

    $ brew remove node
    $ brew install nvm
    $ nvm install 5
    $ nvm alias default 5
    $ npm install -g mern-cli
    $ mern init your_new_app
    $ cd your_new_app
    $ npm install
    $ npm run test
    

    【讨论】:

      【解决方案2】:

      在另一个帖子/网站上找到:更新 package.js 中的 test 脚本,并将 --harmony-proxies 更改为 --harmony。 (参考 n-makarov 于 2 月 12 日评论:https://github.com/coryhouse/react-slingshot/issues/366

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-04-20
        • 2013-07-11
        • 2015-01-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-01-14
        相关资源
        最近更新 更多