流星无法解析某些模块

时间:2018-06-22 23:32:00

标签: javascript meteor packages

在安装以下软件包styluspward123:rupturemquandalle:jeet之后,我正在使用流星,但出现以下错误。我尝试按照建议运行meteor npm install --save @babel/runtime,但没有执行任何操作。这是我尝试运行流星时遇到的错误。

Unable to resolve some modules:

  "@babel/runtime/helpers/interopRequireDefault" in /C/Users/Anders/sites/jlfitsiteDevelopment/client/lib/modernizr-custom.js (web.browser.legacy)
  "@babel/runtime/helpers/typeof" in /C/Users/Anders/sites/jlfitsiteDevelopment/client/lib/modernizr-custom.js (web.browser.legacy)

If you notice problems related to these missing modules, consider running:

  meteor npm install --save @babel/runtime

W20180622-17:28:30.133(-6)? (STDERR) C:\Users\Anders\sites\jlfitsiteDevelopment\.meteor\local\build\programs\server\boot.js:475
W20180622-17:28:30.134(-6)? (STDERR) }).run();
W20180622-17:28:30.134(-6)? (STDERR)    ^
W20180622-17:28:30.135(-6)? (STDERR)
W20180622-17:28:30.135(-6)? (STDERR) Error: The @babel/runtime npm package could not be found in your node_modules
W20180622-17:28:30.136(-6)? (STDERR) directory. Please run the following command to install it:
W20180622-17:28:30.136(-6)? (STDERR)
W20180622-17:28:30.136(-6)? (STDERR)   meteor npm install --save @babel/runtime
W20180622-17:28:30.136(-6)? (STDERR)
W20180622-17:28:30.137(-6)? (STDERR)     at babel-runtime.js (packages\babel-runtime.js:25:9)
W20180622-17:28:30.137(-6)? (STDERR)     at fileEvaluate (packages\modules-runtime.js:339:7)
W20180622-17:28:30.137(-6)? (STDERR)     at require (packages\modules-runtime.js:238:16)
W20180622-17:28:30.137(-6)? (STDERR)     at packages\babel-runtime.js:79:15
W20180622-17:28:30.138(-6)? (STDERR)     at packages\babel-runtime.js:86:3
W20180622-17:28:30.138(-6)? (STDERR)     at C:\Users\Anders\sites\jlfitsiteDevelopment\.meteor\local\build\programs\server\boot.js:411:36
W20180622-17:28:30.138(-6)? (STDERR)     at Array.forEach (<anonymous>)
W20180622-17:28:30.139(-6)? (STDERR)     at C:\Users\Anders\sites\jlfitsiteDevelopment\.meteor\local\build\programs\server\boot.js:220:19
W20180622-17:28:30.139(-6)? (STDERR)     at C:\Users\Anders\sites\jlfitsiteDevelopment\.meteor\local\build\programs\server\boot.js:471:5
W20180622-17:28:30.139(-6)? (STDERR)     at Function.run (C:\Users\Anders\sites\jlfitsiteDevelopment\.meteor\local\build\programs\server\profile.js:510:12)

.meteor /包裹

mongo@1.5.0                   # The database Meteor supports right now
blaze-html-templates    # Compile .html files into Meteor Blaze views
session@1.1.7                 # Client-side reactive dictionary for your app
jquery                  # Helpful client-side library
tracker@1.2.0                 # Meteor's client-side reactive programming library

standard-minifiers@1.1.0      # JS/CSS minifiers run for production mode
es5-shim@4.8.0                # ECMAScript 5 compatibility for older browsers.
ecmascript@0.11.1              # Enable ECMAScript2015+ syntax in app code

autopublish@1.0.7             # Publish all data to the clients (for prototyping)
insecure@1.0.7                # Allow all DB writes from clients (for prototyping)
iron:router
sewdn:masked-input
themeteorchef:jquery-validation
email@1.2.3
johannesma:meteor-flexslider
slam310:smooth-scroll
underscore
stylus
mquandalle:jeet
pward123:rupture

2 个答案:

答案 0 :(得分:1)

如果没有package.jsonnode_modules目录,那绝对是您的问题!

项目的根目录应该有package.json:

C:\Users\Anders\sites\jlfitsiteDevelopment\

您可能可以安全地从全新的meteor create复制包json:

{
  "name": "~name~",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --once --driver-package meteortesting:mocha",
    "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer"
  },
  "dependencies": {
    "@babel/runtime": "^7.0.0-beta.51",
    "meteor-node-stubs": "^0.4.1"
  }
}

然后添加您需要的任何其他依赖项

答案 1 :(得分:1)

万一这对其他人有帮助:上面的答案不适用于我。我已经运行过npm install来初始化目录,但是我的版本存在问题 我升级到Meteor 1.7.x后,babel/runtime不能正常工作

我通过运行以下命令降级了babel的版本: meteor npm install --save-exact @babel/runtime@7.0.0-beta.55