javascript - 由于找不到 @babel/runtime,从 1.6.0.1 更新到我的 meteor 应用程序 1.6.1 失败

标签 javascript meteor babeljs

我在win 10上从1.6.0.1更新到meteor 1.6.1。然后我将meteor应用程序更新到1.6.1。看起来一切顺利。但是当我运行该应用程序时,系统会提示我安装@babel/runtime。

c:\meteor\myapp>meteor
[[[[[ c:\meteor\myapp ]]]]]

=> Started proxy.
=> Started MongoDB.
W20180130-07:40:18.156(0)? (STDERR) c:\meteor\myapp\.meteor\local\build\programs\server\boot.js:475
W20180130-07:40:18.905(0)? (STDERR) }).run();
W20180130-07:40:18.908(0)? (STDERR)    ^
W20180130-07:40:18.909(0)? (STDERR)
W20180130-07:40:18.910(0)? (STDERR) Error: The @babel/runtime npm package could not be found in your node_modules
W20180130-07:40:18.912(0)? (STDERR) directory. Please run the following command to install it:
W20180130-07:40:18.915(0)? (STDERR)
W20180130-07:40:18.917(0)? (STDERR)   meteor npm install --save @babel/runtime
W20180130-07:40:18.918(0)? (STDERR)
W20180130-07:40:18.920(0)? (STDERR)     at babel-runtime.js (packages\babel-runtime.js:25:9)
W20180130-07:40:18.921(0)? (STDERR)     at fileEvaluate (packages\modules-runtime.js:343:9)
W20180130-07:40:18.922(0)? (STDERR)     at require (packages\modules-runtime.js:238:16)
W20180130-07:40:18.925(0)? (STDERR)     at packages\babel-runtime.js:132:15
W20180130-07:40:18.926(0)? (STDERR)     at packages\babel-runtime.js:139:3
W20180130-07:40:18.928(0)? (STDERR)     at c:\meteor\myapp\.meteor\local\build\programs\server\boot.js:411:36
W20180130-07:40:18.929(0)? (STDERR)     at Array.forEach (<anonymous>)
W20180130-07:40:18.931(0)? (STDERR)     at c:\meteor\myapp\.meteor\local\build\programs\server\boot.js:220:19
W20180130-07:40:18.932(0)? (STDERR)     at c:\meteor\myapp\.meteor\local\build\programs\server\boot.js:471:5
W20180130-07:40:18.934(0)? (STDERR)     at Function.run (c:\meteor\myapp\.meteor\local\build\programs\server\profile.js:510:12)
=> Exited with code: 1
...
=> Your application is crashing. Waiting for file change.
Terminate batch job (Y/N)? y

当我尝试安装它时,出现此错误

c:\meteor\myapp>meteor npm install --save @babel/runtime
npm ERR! code E404
npm ERR! 404 Not Found: @babel/runtime@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\myuser\AppData\Roaming\npm-cache\_logs\2018-01-29T19_10_08_271Z-debug.log

即将退回到 1.6.0.1,但希望理想地解决此问题。

最终恢复到1.6.0.1版本。我的应用程序再次运行。将来可能会不情愿地升级:–((

最佳答案

更新 npm 模块还需要做一些工作,@babel/runtime 就是其中之一。

The babel-runtime npm package has been required for all Meteor applications since Meteor 1.3. With Babel 7, babel-runtime has been renamed to @babel/runtime. If you update to Meteor 1.6.1 without adding @babel/runtime to your package.json dependencies, the Meteor babel-runtime package will throw a helpful error that recommends running meteor npm install @babel/runtime. You should follow this advice!

This change of names is in fact pretty convenient, because it allows @babel/runtime to be installed alongside babel-runtime, in case you need both for some reason; for example, if you rely on a custom Babel plugin that still assumes babel-runtime is installed.

Most Meteor developers should be able to remove babel-runtime after adding @babel/runtime, though there’s no harm in leaving it installed, since none of its modules will be bundled unless they’re used.

如果您阅读 MDG 的这篇文章,它将解释您需要做什么。 https://blog.meteor.com/announcing-meteor-1-6-1-50aad71da4e6

关于javascript - 由于找不到 @babel/runtime,从 1.6.0.1 更新到我的 meteor 应用程序 1.6.1 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48518570/

相关文章:

javascript - 自定义Verify.js验证规则不适用

javascript - 强制对 ajax 查询参数进行转义

node.js - 在 Node 6.11.5 上安装 couchbase 失败

javascript - 在 Meteor JS 环境中运行 JavaScript 文件

javascript - 如何加载测试 JavaScript/AngularJS 应用程序?

node.js - React-Router 和 Meteor 无法在刷新时使用参数渲染路由

node.js - "require external module babel-register"执行时间长

sublimetext3 - 包控制 : Install Package missing in Sublime Text 3

node.js - Babel 将异步到模块方法转换为带有 ES6 映射的 Bluebird

php - 如何将动态生成的图像保存到数据库