Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot call method 'split' of undefined #10083

Closed
scottcwilliams511 opened this issue Jul 18, 2018 · 9 comments
Closed

TypeError: Cannot call method 'split' of undefined #10083

scottcwilliams511 opened this issue Jul 18, 2018 · 9 comments
Assignees
Milestone

Comments

@scottcwilliams511
Copy link

scottcwilliams511 commented Jul 18, 2018

  • [1.7.0.3 ] The version of Meteor showing the problem.
  • [1.6.0.1 ] The last version of Meteor where the problem did not occur, if applicable.
  • [Linux] The operating system you're running Meteor on.

This "bug" seems to have happened to the past to people: #7311

On updating Meteor 1.6.0.1 to 1.7.0.3, the build process is now failing.

Running my Meteor application locally with 1.7.0.3 works fine though.

I am using jshimko/meteor-launchpad to build for docker. I have configured launchpad.conf to contain

NODE_VERSION=8.11.3

This is .meteor/packages: https://gist.github.com/scottcwilliams511/513af2f9b8453d4d5e851603d59ddbcd

This is .meteor/versions: https://gist.github.com/scottcwilliams511/4a82d2064e71bfc9e86e5a0d3e247166

This is package.json:
https://gist.github.com/scottcwilliams511/af309efcd15c078b13eda76c41f06e01

Some output:

[09:48:39][Step 1/1] [-] Building Meteor application...
[09:48:39][Step 1/1] 
[09:48:39][Step 1/1] 
[09:48:39][Step 1/1] Even with METEOR_ALLOW_SUPERUSER or --allow-superuser, permissions in your app
[09:48:39][Step 1/1] directory will be incorrect if you ever attempt to perform any Meteor tasks as
[09:48:39][Step 1/1] a normal user. If you need to fix your permissions, run the following command
[09:48:39][Step 1/1] from the root of your project:
[09:48:39][Step 1/1] 
[09:48:39][Step 1/1]   sudo chown -Rh <username> .meteor/local
[09:48:39][Step 1/1] 
[09:49:12][Step 1/1] internal/process/next_tick.js:131
[09:49:12][Step 1/1]       callback();
[09:49:12][Step 1/1]       ^
[09:49:12][Step 1/1] 
[09:49:12][Step 1/1] TypeError: Cannot read property 'split' of undefined
[09:49:12][Step 1/1]     at Object.parse (/tools/utils/parse-stack.js:19:28)
[09:49:12][Step 1/1]     at Object.exception (/tools/utils/buildmessage.js:497:29)
[09:49:12][Step 1/1]     at /tools/isobuild/compiler-plugin.js:195:26
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:359:18
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:352:34
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:350:23
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at Object.enterJob (/tools/utils/buildmessage.js:324:26)
[09:49:12][Step 1/1]     at Profile.time (/tools/isobuild/compiler-plugin.js:181:22)
[09:49:12][Step 1/1]     at Function.time (/tools/tool-env/profile.js:305:10)
[09:49:12][Step 1/1]     at /tools/isobuild/compiler-plugin.js:180:15
[09:49:12][Step 1/1]     at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.7.0_3.u9lhms.hf7k++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:87:22)
[09:49:12][Step 1/1]     at CompilerPluginProcessor.runCompilerPlugins (/tools/isobuild/compiler-plugin.js:170:7)
[09:49:12][Step 1/1]     at ClientTarget._runCompilerPlugins (/tools/isobuild/bundler.js:1054:22)
[09:49:12][Step 1/1]     at buildmessage.enterJob (/tools/isobuild/bundler.js:834:34)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:359:18
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:352:34
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:350:23
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at Object.enterJob (/tools/utils/buildmessage.js:324:26)
[09:49:12][Step 1/1]     at ClientTarget.make (/tools/isobuild/bundler.js:828:18)
[09:49:12][Step 1/1]     at /tools/isobuild/bundler.js:3019:14
[09:49:12][Step 1/1]     at /tools/isobuild/bundler.js:3108:20
[09:49:12][Step 1/1]     at Array.forEach (<anonymous>)
[09:49:12][Step 1/1]     at Function._.each._.forEach (/root/.meteor/packages/meteor-tool/.1.7.0_3.u9lhms.hf7k++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
[09:49:12][Step 1/1]     at /tools/isobuild/bundler.js:3107:7
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:271:13
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:264:29
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:262:18
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at /tools/utils/buildmessage.js:253:23
[09:49:12][Step 1/1]     at exports.EnvironmentVariable.withValue (/tools/utils/fiber-helpers.js:89:14)
[09:49:12][Step 1/1]     at Object.capture (/tools/utils/buildmessage.js:252:19)
[09:49:12][Step 1/1]     at bundle (/tools/isobuild/bundler.js:3000:31)
[09:49:12][Step 1/1]     at files.withCache (/tools/isobuild/bundler.js:2947:32)
[09:49:12][Step 1/1]     at Object.withCache (/tools/fs/files.js:1710:12)
[09:49:12][Step 1/1]     at Object.exports.bundle (/tools/isobuild/bundler.js:2947:16)
[09:49:12][Step 1/1]     at buildCommand (/tools/cli/commands.js:1022:30)
[09:49:12][Step 1/1]     at Command.func (/tools/cli/commands.js:898:12)
[09:49:12][Step 1/1]     at /tools/cli/main.js:1531:15
[09:49:13][Step 1/1] The command '/bin/sh -c cd $APP_SOURCE_DIR &&   $BUILD_SCRIPTS_DIR/install-deps.sh &&   $BUILD_SCRIPTS_DIR/install-node.sh &&   $BUILD_SCRIPTS_DIR/install-phantom.sh &&   $BUILD_SCRIPTS_DIR/install-graphicsmagick.sh &&   $BUILD_SCRIPTS_DIR/install-mongo.sh &&   $BUILD_SCRIPTS_DIR/install-meteor.sh &&   $BUILD_SCRIPTS_DIR/build-meteor.sh &&   $BUILD_SCRIPTS_DIR/post-build-cleanup.sh' returned a non-zero code: 1

I have tried removing pieces of the project and re-building as suggested here: #7311 (comment) but have not had luck.

@benjamn
Copy link
Contributor

benjamn commented Jul 18, 2018

Thanks for the thorough report!

This seems to be a problem in the code that rewrites Node stack traces to reflect source maps generated during compilation of the code that implements the meteor command-line tool.

In other words, the bug might have something to do with changes in the way Babel generates those source maps, or perhaps due to updates to the source-map library (though I don't recall any recently).

This problem might have gone unnoticed also because it only happens when an unexpected exception is thrown by the build tool, since otherwise there is no need to rewrite source maps.

Have you tried running your reproduction after updating to the latest Meteor 1.7.1 beta release?

meteor update --release 1.7.1-beta.19

@scottcwilliams511
Copy link
Author

When I try running the build script with 1.7.1-beta.19 (or 1.7.1-beta.18), I end up getting this output

[13:33:52][Step 1/1] * Connection #0 to host install.meteor.com left intact
[13:33:52][Step 1/1] 
[13:33:52][Step 1/1] [-] Installing Meteor 1.7.1-beta.19...
[13:33:52][Step 1/1] 
[13:33:52][Step 1/1] Downloading Meteor distribution
[13:33:52][Step 1/1] Retrying download in 5 seconds...
[13:33:58][Step 1/1] Retrying download in 5 seconds...
[13:34:03][Step 1/1] Retrying download in 5 seconds...
[13:34:08][Step 1/1] Retrying download in 5 seconds...
[13:34:14][Step 1/1] Retrying download in 5 seconds...
[13:34:19][Step 1/1] Retrying download in 5 seconds...
[13:34:24][Step 1/1] Retrying download in 5 seconds...
[13:34:30][Step 1/1] Retrying download in 5 seconds...
[13:34:35][Step 1/1] Retrying download in 5 seconds...
[13:34:40][Step 1/1] Retrying download in 5 seconds...

Which I've never seen before. I tested the build script on my stable 1.6.0.1 version and it was able to download the Meteor distribution, so I'm guessing something in jshimko/meteor-launchpad isn't working the same for beta releases (source that calls the meteor install script) https://github.com/jshimko/meteor-launchpad/blob/master/scripts/install-meteor.sh

Additionally, I tried running the source commands on a local virtual machine and this is the install file that was modified: https://gist.github.com/scottcwilliams511/2baac07320bbe4cc2dc11aa2d05f6ef1
This also gave the output

curl: (22) The requested URL returned error: 403 Forbidden
Retrying download in 5 seconds...

However, when I changed RELEASE="1.7.1-beta.18" to RELEASE="1.7.0.3" the download starts fine and doesn't bomb out.

@benjamn
Copy link
Contributor

benjamn commented Jul 25, 2018

It looks like you're trying to download the full Meteor distribution (from install.meteor.com) for a beta version, which won't work because we don't publish those archives until the final release.

To install Meteor 1.7.1 beta versions, you should run (for example)

meteor update --release 1.7.1-beta.21

If you run that command in an application directory, it will update the application to the beta version. Alternatively, if you want to create a new app with the beta version, you can run

meteor create --release 1.7.1-beta.21 my-new-app

@markanye
Copy link

markanye commented Aug 7, 2018

@benjamn I encountered this exact same issue while trying to upgrade a project from 1.5.4.2 to 1.7.0.3. The problem turned out to be a template compile error. The error parsing function in parse-stack.js seems to be expecting a javascript error object when it's called during the build process, but for at least some kind of template parse problems it's getting a long string instead, so err.stack.split() fails with a "Cannot read property 'split' of undefined".

Just for fun I threw a console.log(err) at the top of parse(err) and got the following output:

Parse Error: <br \>.browser | Expires on {[{referenceTransaction.expdate.substr(0,2)}]}/{[{referenceTransaction.expdate.substr(2,4)}]}<br \> (continued)

So I fixed my improperly formatted line break and I was off to the races.

@milos2211
Copy link

I had same problem on 1.7.1-beta.15.
Turn's out that problem was coming @import in less. I've changed path of file that was imported and didn't update the import.

@benjamn benjamn added this to the Release 1.7.1 milestone Sep 11, 2018
@benjamn benjamn self-assigned this Sep 11, 2018
benjamn added a commit that referenced this issue Oct 3, 2018
@benjamn
Copy link
Contributor

benjamn commented Oct 3, 2018

This should be fixed if you update your app with meteor update --release 1.8-rc.17. Please feel free to open a new issue if you're still having problems!

@benjamn benjamn closed this as completed Oct 3, 2018
@scottcwilliams511
Copy link
Author

Thanks you! This allowed me to see this error:

=> Started proxy.
=> Errors prevented startup:

   While processing files with angular-templates (for target web.browser):
   error: undefined

   While processing files with angular-templates (for target web.browser.legacy):
   error: undefined

=> Your application has errors. Waiting for file change.

which allowed me to diagnose and fix what was wrong with the app. All is good now!

Also, congrats on the 1.8 release!

@ssinghwyest
Copy link

@scottcwilliams511 I am also getting the same errors

=> Started proxy.
=> Errors prevented startup:

While processing files with angular-templates (for target web.browser):
error: undefined

While processing files with angular-templates (for target web.browser.legacy):
error: undefined

=> Your application has errors. Waiting for file change.

I would like to know how you have fixed this errors.

Thank u

@scottcwilliams511
Copy link
Author

@scottcwilliams511 I am also getting the same errors

=> Started proxy.
=> Errors prevented startup:
While processing files with angular-templates (for target web.browser):
error: undefined
While processing files with angular-templates (for target web.browser.legacy):
error: undefined
=> Your application has errors. Waiting for file change.

I would like to know how you have fixed this errors.

Thank u

Assuming your issue was identical to mine, this is what I followed:

Urigo/angular-meteor#1878
To sum up that, "angular-templates" is out of date so I removed that and added "angular-compilers". I believe I also had to remove "fourseven:scss" as "angular-compilers" takes care of what that package has.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants