Closed itsashis4u closed 8 years ago
Which version of generator-polymer do you use? I couldn't reproduce the issue
I have the same or a similar issue:
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:element add-name
? Would you like to include an import in your elements.html file? No
? What type of test would you like to create? TDD
events.js:85
throw er; // Unhandled 'error' event
^
AssertionError: Trying to copy from a source that does not exist: /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/element/templates/element.html
at EditionInterface.exports._copySingle (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:45:3)
at EditionInterface.exports.copy (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:23:17)
at EditionInterface.module.exports [as copyTpl] (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy-tpl.js:16:8)
at module.exports.yeoman.generators.Base.extend.el (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/el/index.js:100:13)
at /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:358:17)
My version of generator-polymer is 1.2.3
. I'm on OSX, and have generator-angular working just fine. NPM install paths, $PATH, etc. look fine from where I'm standing...
Any more info I can give you to help with this? I'd love to get this up and running.
@itsashis4u I can reduce same problem. it was raised when answer Yes.
I'm having the same issue
john@njohn ~/Projects/l0gical $ yo polymer:el settings-data --docs
? Would you like to include an import in your elements.html file? Yes
? What type of test would you like to create? TDD
events.js:141
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'replace' of undefined
at module.exports.yeoman.generators.Base.extend.el (/usr/lib/node_modules/generator-polymer/el/index.js:109:14)
at /usr/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:368:17)```
If i chose not to include the import to elements.html then it works
john@njohn ~/Projects/l0gical $ yo polymer:el settings-data --docs
? Would you like to include an import in your elements.html file? No
? What type of test would you like to create? TDD
create app/elements/settings-data/settings-data.html
create app/test/settings-data-basic.html
create app/elements/settings-data/index.html
create app/elements/settings-data/demo/index.htm
generator version is 1.2.3
I'm traveling on vacation till the 23rd but will try to find time to look at this. If anyone wants to submit a PR to fix before I get to it then that would also be awesome :cake: :)
I've sent a PR! I'm quite new in web development and git, hope it works!
Should it create a new elements.html when creating an element outside a polymer project? what if it doesn't prompts to add the import to elements.html if you run outside the root of a project? @hemanth Should I create a new PR?
It was intended to only ever work inside a PSK project. Maybe the problem is folks are running it outside a scaffolded project? To create a standalone element you want to run yo polymer:seed
Yes, It crashed only when running outside the project. I'm creating an error to address the issue
For what it's worth: I was running yo polymer:element add-name
inside my scaffolded project.
I get my error on any combination of answers to the 2 prompts:
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:element add-name
? Would you like to include an import in your elements.html file? Yes
? What type of test would you like to create? TDD
events.js:85
throw er; // Unhandled 'error' event
^
AssertionError: Trying to copy from a source that does not exist: /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/element/templates/element.html
at EditionInterface.exports._copySingle (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:45:3)
at EditionInterface.exports.copy (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:23:17)
at EditionInterface.module.exports [as copyTpl] (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy-tpl.js:16:8)
at module.exports.yeoman.generators.Base.extend.el (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/el/index.js:100:13)
at /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:358:17)
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:element add-name
? Would you like to include an import in your elements.html file? No
? What type of test would you like to create? TDD
events.js:85
throw er; // Unhandled 'error' event
^
AssertionError: Trying to copy from a source that does not exist: /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/element/templates/element.html
at EditionInterface.exports._copySingle (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:45:3)
at EditionInterface.exports.copy (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:23:17)
at EditionInterface.module.exports [as copyTpl] (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy-tpl.js:16:8)
at module.exports.yeoman.generators.Base.extend.el (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/el/index.js:100:13)
at /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:358:17)
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:element add-name
? Would you like to include an import in your elements.html file? No
? What type of test would you like to create? None
events.js:85
throw er; // Unhandled 'error' event
^
AssertionError: Trying to copy from a source that does not exist: /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/element/templates/element.html
at EditionInterface.exports._copySingle (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:45:3)
at EditionInterface.exports.copy (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy.js:23:17)
at EditionInterface.module.exports [as copyTpl] (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/mem-fs-editor/actions/copy-tpl.js:16:8)
at module.exports.yeoman.generators.Base.extend.el (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/el/index.js:100:13)
at /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:358:17)
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$
@SterlingVix try running yo polymer:el
and see if that makes a difference. Looks like it's searching for a relative path to the template in the element
dir but it only lives in the el
dir.
@robdodson Thanks for the reply.
I'm not at that computer anymore (will be back tomorrow), but I will say that the original issue happened regardless of whether I was using element
or el
. If I remember correctly, the element
location just contained a reference to the el
location.
I'll confirm tomorrow with el
and send the terminal output, but I expect to get the same results.
@robdodson Worked!
First I updated my generator through the yo
interface, then I ran the element command with el
:
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:el custom-component
? Would you like to include an import in your elements.html file? Yes
? What type of test would you like to create? None
events.js:85
throw er; // Unhandled 'error' event
^
TypeError: Cannot read property 'replace' of undefined
at module.exports.yeoman.generators.Base.extend.el (/Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/el/index.js:109:14)
at /Users/aaronmelocik/.npm-packages/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:358:17)
aaronmelocik@Vonnegut:/private/var/www/metrodigi/testing/generator-polymer$ yo polymer:el custom-component
? Would you like to include an import in your elements.html file? No
? What type of test would you like to create? TDD
create app/elements/custom-component/custom-component.html
create app/test/custom-component-basic.html
As reported by other users, I get the elements if I answer "no" to "Would you like to include an import in your elements.html file?", otherwise it fails.
I have the same problem. Looking at index.js file where the error is reported, I can see the var el declared, but I can't see anywhere in this file where it is being set, before the line the errors.
el = el.replace(...)
I think it might need something like
// make app/elements/elementName/elementName el = path.join(pathToEl,this.elementName);
But I am puzzling why we might have a backslash in there that needs replacing with a forward slash.
Same error here, crashing with yo polymer:seed
events.js:141
throw er; // Unhandled 'error' event
^
AssertionError: Trying to copy from a source that does not exist: /Users/Francisco/npm/lib/node_modules/generator-polymer/seed/templates/seed-element/.gitignore
at EditionInterface.exports._copySingle (/Users/Francisco/npm/lib/node_modules/generator-polymer/node_modules/yeoman-generator/node_modules/mem-fs-editor/actions/copy.js:45:3)
at EditionInterface.exports.copy (/Users/Francisco/npm/lib/node_modules/generator-polymer/node_modules/yeoman-generator/node_modules/mem-fs-editor/actions/copy.js:23:17)
at module.exports.yeoman.generators.Base.extend.seed (/Users/Francisco/npm/lib/node_modules/generator-polymer/seed/index.js:125:15)
at /Users/Francisco/npm/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16
at processImmediate [as _immediateCallback] (timers.js:368:17)
Hi,
Same issue
Alright, I took a dive into exactly what is happening here and the great news is I have a solution that we can get out to everyone in the next few hours :clap:
On the last release of the project, whoever published to npm did not run git submodule update --init --recursive
What¿ you may be asking yourself...
Well to understand what is going on, lets take a few steps back...... The error that everyone was getting was caused because seed-element.html does not exist at the path
If you do a fresh clone of this repo you will notice there is nothing in this folder at all!
This got me thinking :cloud: .. What is actually going on. Well way back in in 0ff409ef96980d1ca16400030d756aba7fffadef the project decided to use a git submodule, which means that whoever publishes this package, need to make sure to run git submodule update --init --recursive
before publishing which will hydrate the files :)
needless to say I think that that step was skipped on the last publish, Once you run the command everything works like a charm :+1: (and all the maintainers of the project need to do is run the command and bump and publish the generator)
huzzah! :sparkles: :sparkles: :sparkles: :sparkles: :sparkles:
TLDR
git submodule update --init --recursive
:shipit:
@samccone :+1: Uber cool!
@samccone :beers:
1.2.4 published. Thanks for looking into this @samccone :)
Someone should add a prepublish
step that does git submodule update --init --recursive
just in case.
@samccone thanks so much for figuring this out! I've been through git submodule
hell before - I agree with the suggestion to automate that command wherever possible.
I'm still getting this issue on the latest version
Darwin MacBook-Pro.local 14.5.0 Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
yo: 1.4.8 yo polymer: 1.2.4
yo polymer:element bc-util-dropzone ? Would you like to include an import in your elements.html file? No ? What type of test would you like to create? TDD events.js:85 throw er; // Unhandled 'error' event ^ AssertionError: Trying to copy from a source that does not exist: /usr/local/lib/node_modules/generator-polymer/element/templates/element.html at EditionInterface.exports._copySingle (/usr/local/lib/node_modules/generator-polymer/node_modules/yeoman-generator/node_modules/mem-fs-editor/actions/copy.js:45:3) at EditionInterface.exports.copy (/usr/local/lib/node_modules/generator-polymer/node_modules/yeoman-generator/node_modules/mem-fs-editor/actions/copy.js:23:17) at EditionInterface.module.exports [as copyTpl] (/usr/local/lib/node_modules/generator-polymer/node_modules/yeoman-generator/node_modules/mem-fs-editor/actions/copy-tpl.js:16:8) at module.exports.yeoman.generators.Base.extend.el (/usr/local/lib/node_modules/generator-polymer/el/index.js:100:13) at /usr/local/lib/node_modules/generator-polymer/node_modules/yeoman-generator/lib/base.js:429:16 at processImmediate [as _immediateCallback] (timers.js:358:17)
yo polymer:el does work though,
yo polymer:el bc-util-dropzone ? Would you like to include an import in your elements.html file? No ? What type of test would you like to create? TDD create app/elements/bc-util-dropzone/bc-util-dropzone.html create app/test/bc-util-dropzone-basic.html
@rootsco I think I have a fix here: https://github.com/yeoman/generator-polymer/pull/244
yo polymer:element
is an alias for yo polymer:el
and its trying to copy from its own template directory (which doesn't actually exist). The short term workaround is to use yo polymer:el
until this patch is landed.