当 运行 背靠背时,Meteor 构建失败
Meteor build fails when run back to back
我正在尝试了解 Meteor 构建过程,以提高我的 dockerized Meteor 应用程序的性能。我发现如果我 运行 meteor build build --directory --server-only
两次,背靠背,我会收到关于无法在第二个 运行.[=15 上解析 json 的错误=]
这是第一个成功的运行:
❯❯❯ meteor build build --directory --server-only
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
Minifying app stylesheet /
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config can
be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Minifying app code \
这是第二个不成功的 运行。请注意,我在 运行s:
之间没有做任何事情
❯❯❯ meteor build build --directory --server-only
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:
218
throw error;
^
SyntaxError: Unexpected token u in JSON at position 1
at JSON.parse (<anonymous>)
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:321:17
at wrap.makeCacheKey (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:36:
15)
at recomputeNewValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimis
m/src/entry.ts:182:31)
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at reallyRecompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:165:19)
at Entry.recompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:85:9)
at optimistic (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/i
ndex.ts:101:25)
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:366:19
at recomputeNewValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimis
m/src/entry.ts:182:31)
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at reallyRecompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:165:19)
at Entry.recompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:85:9)
at optimistic (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/i
ndex.ts:101:25)
at find (/tools/isobuild/package-source.js:1339:30)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at find (/tools/isobuild/package-source.js:1406:25)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1418:34
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:18)
at PackageSource._findSources (/tools/isobuild/package-source.js:1418:18)
at SourceArch.getFiles (/tools/isobuild/package-source.js:960:32)
at /tools/isobuild/compiler.js:406:23
at /tools/isobuild/compiler.js:186:28
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:18)
at /tools/isobuild/compiler.js:185:11
at Function._.each._.forEach (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules
/underscore/underscore.js:186:9)
at Object.compile (/tools/isobuild/compiler.js:180:5)
at /tools/isobuild/bundler.js:3268:24
at Object.capture (/tools/utils/buildmessage.js:283:5)
at bundle (/tools/isobuild/bundler.js:3214:31)
at /tools/isobuild/bundler.js:3157:32
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:39)
at Object.bundle (/tools/isobuild/bundler.js:3157:16)
at buildCommand (/tools/cli/commands.js:1082:30)
at /tools/cli/commands.js:945:25
at Function.run (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/tool-env/tools/tool-env/profile.ts
:289:14)
at /tools/cli/commands.js:943:18
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/fiber_pool.
js:43:40
=> awaited here:
at Promise.await (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-prom
ise/promise_server.js:60:12)
at /tools/cli/main.js:1529:7
我也尝试过使用不同的目录输出执行第二个 运行,但得到相同的结果:
❯❯❯ meteor build .. --directory --server-only
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies: http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:
218
throw error;
^
SyntaxError: Unexpected token u in JSON at position 1
at JSON.parse (<anonymous>)
为什么连续两次尝试构建 meteor 都构建失败?
发生的情况是您生成了构建的应用程序但未将其捆绑(使用 --directory
flag)。
因此你的文件结构中有额外的 JS 文件。
并且在您的尝试中,它们与您的 Meteor 项目结构混合,在 build
文件夹中(当您使用命令 meteor build build --directory
时)或直接合并(meteor build .. --directory
)。
因此,在下一个构建 运行 中,Meteor 会选择这些额外的 JS 文件,就好像它们是您的源代码的一部分一样(预先加载),但失败了,如警告消息中所建议的:
The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
如果您指定了一个显式的同级构建文件夹,而不仅仅是父文件夹(因此将文件直接放在您的 Meteor 项目根目录中),它将在您的下一次尝试中起作用,例如meteor build ../siblingFolder
另一种可能的解决方法是使用以点 .
开头的构建文件夹名称,这样 Meteor 在接下来的 运行 中查找源代码时会忽略它,例如meteor build ./.build
请参阅 special directories 文档:
The following directories are also not loaded as part of your app code:
- Files/directories whose names start with a dot, like
.meteor
and .git
我正在尝试了解 Meteor 构建过程,以提高我的 dockerized Meteor 应用程序的性能。我发现如果我 运行 meteor build build --directory --server-only
两次,背靠背,我会收到关于无法在第二个 运行.[=15 上解析 json 的错误=]
这是第一个成功的运行:
❯❯❯ meteor build build --directory --server-only
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
Minifying app stylesheet /
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config can
be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
Minifying app code \
这是第二个不成功的 运行。请注意,我在 运行s:
之间没有做任何事情 ❯❯❯ meteor build build --directory --server-only
WARNING: The output directory is under your source tree.
Your generated files may get interpreted as source code!
Consider building into a different directory instead
meteor build ../output
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:
218
throw error;
^
SyntaxError: Unexpected token u in JSON at position 1
at JSON.parse (<anonymous>)
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:321:17
at wrap.makeCacheKey (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:36:
15)
at recomputeNewValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimis
m/src/entry.ts:182:31)
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at reallyRecompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:165:19)
at Entry.recompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:85:9)
at optimistic (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/i
ndex.ts:101:25)
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/optimistic.ts:366:19
at recomputeNewValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimis
m/src/entry.ts:182:31)
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at reallyRecompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:165:19)
at Entry.recompute (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/
src/entry.ts:85:9)
at optimistic (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/optimism/src/i
ndex.ts:101:25)
at find (/tools/isobuild/package-source.js:1339:30)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at find (/tools/isobuild/package-source.js:1406:25)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1395:27
at Array.forEach (<anonymous>)
at find (/tools/isobuild/package-source.js:1374:22)
at /tools/isobuild/package-source.js:1418:34
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:18)
at PackageSource._findSources (/tools/isobuild/package-source.js:1418:18)
at SourceArch.getFiles (/tools/isobuild/package-source.js:960:32)
at /tools/isobuild/compiler.js:406:23
at /tools/isobuild/compiler.js:186:28
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:18)
at /tools/isobuild/compiler.js:185:11
at Function._.each._.forEach (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules
/underscore/underscore.js:186:9)
at Object.compile (/tools/isobuild/compiler.js:180:5)
at /tools/isobuild/bundler.js:3268:24
at Object.capture (/tools/utils/buildmessage.js:283:5)
at bundle (/tools/isobuild/bundler.js:3214:31)
at /tools/isobuild/bundler.js:3157:32
at Slot.withValue (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/conte
xt/lib/context.js:73:29)
at Object.withCache (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1663:39)
at Object.bundle (/tools/isobuild/bundler.js:3157:16)
at buildCommand (/tools/cli/commands.js:1082:30)
at /tools/cli/commands.js:945:25
at Function.run (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/tool-env/tools/tool-env/profile.ts
:289:14)
at /tools/cli/commands.js:943:18
at /home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/fiber_pool.
js:43:40
=> awaited here:
at Promise.await (/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-prom
ise/promise_server.js:60:12)
at /tools/cli/main.js:1529:7
我也尝试过使用不同的目录输出执行第二个 运行,但得到相同的结果:
❯❯❯ meteor build .. --directory --server-only
WARNING: npm peer requirements (for juliancwirko:postcss) not installed:
- postcss@8.2.6 installed, postcss@^7.0.0 needed
- postcss-load-config@3.0.1 installed, postcss-load-config@^2.1.0 needed
Read more about installing npm peer dependencies: http://guide.meteor.com/using-packages.html#peer-npm-dependencies
/home/paymahn1/.meteor/packages/meteor-tool/.2.1.0.udr5f0.57lxg++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:
218
throw error;
^
SyntaxError: Unexpected token u in JSON at position 1
at JSON.parse (<anonymous>)
为什么连续两次尝试构建 meteor 都构建失败?
发生的情况是您生成了构建的应用程序但未将其捆绑(使用 --directory
flag)。
因此你的文件结构中有额外的 JS 文件。
并且在您的尝试中,它们与您的 Meteor 项目结构混合,在 build
文件夹中(当您使用命令 meteor build build --directory
时)或直接合并(meteor build .. --directory
)。
因此,在下一个构建 运行 中,Meteor 会选择这些额外的 JS 文件,就好像它们是您的源代码的一部分一样(预先加载),但失败了,如警告消息中所建议的:
The output directory is under your source tree. Your generated files may get interpreted as source code! Consider building into a different directory instead meteor build ../output
如果您指定了一个显式的同级构建文件夹,而不仅仅是父文件夹(因此将文件直接放在您的 Meteor 项目根目录中),它将在您的下一次尝试中起作用,例如meteor build ../siblingFolder
另一种可能的解决方法是使用以点 .
开头的构建文件夹名称,这样 Meteor 在接下来的 运行 中查找源代码时会忽略它,例如meteor build ./.build
请参阅 special directories 文档:
The following directories are also not loaded as part of your app code:
- Files/directories whose names start with a dot, like
.meteor
and.git