DoneJS Error: add component

Starting from Scratch, I installed the following on Windows 7 Home Premium:

  • Node - v0.12.9
  • Npm - 2.14.9
  • Chocolatey
  • Python 2.7.11
  • Windows SDK 7.1
  • Visual Studio Express 2014 Desktop

Then rand the following a the command prompt:

npm install -g donejs
npm init donejs-chat
npm install bootstrap --save

All of the above ran just fine w/o any errors…

When I get to the following section of the Quick Start Guide:

http://donejs.com/Guide.html#section=section_Generatecustomelements

I get the following error when trying to add a component:

C:__source\donejs\donejs-chat>donejs add component home.component chat-home
x No ‘folder’ or ‘appName’ specified. Neither in your .yo-rc.json nor in your package.json file

Not sure what needs to be done to remedy the issue…

Any assistance is greatly appreciated!!

Is there a .yo-rc.json? Can you show the contents here?

.yo-rc-json does not exist…

The following is the list of files in the project folder:

.gitignore
build.js
development.html
documentjs.json
node_modules
package.json
production.html
readme.md

The following is the src contents:

C:__SOURCE\DONEJS\DONEJS-CHAT\SRC
| app.js
| index.md
| index.stache
| styles.less
| test.html
|
±–models
| | test.js
| |
| —fixtures
| fixtures.js
|
—test
functional.js
test.js

I’ll take a look at it in about 30 min. My guess is that it was caused by https://github.com/donejs/generator-donejs/commit/cc003434fe49e2727823b374b44e7a63f05c0569

Actually, that version would produce a different error. Can you run an ‘npm cache clean’ and try ‘donejs init’ again?

Well… It didn’t like that cache clean…

C:__source\donejs>donejs init donejs-chat
Initializing new DoneJS application at C:__source\donejs\donejs-chat
Installing donejs-cli

spawn-sync@1.0.15 postinstall C:__source\donejs\donejs-chat\node_modules\donejs-cli\node_modules\yeoman-gene
rator\node_modules\cross-spawn\node_modules\spawn-sync
node postinstall

npm ERR! Windows_NT 6.1.7601
npm ERR! argv “C:\Program Files\nodejs\\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cl
i.js” “install” “donejs-cli@^0.6.0” “–loglevel” “error”
npm ERR! node v0.12.9
npm ERR! npm v2.14.9
npm ERR! path C:\Users\TheGriz\AppData\Roaming\npm-cache\xtend\4.0.1\package\package.json
npm ERR! code EPERM
npm ERR! errno -4048

npm ERR! Error: EPERM, rename ‘C:\Users\TheGriz\AppData\Roaming\npm-cache\xtend\4.0.1\package\package.json’
npm ERR! at Error (native)
npm ERR! { [Error: EPERM, rename ‘C:\Users\TheGriz\AppData\Roaming\npm-cache\xtend\4.0.1\package\package.json’]

npm ERR! errno: -4048,
npm ERR! code: ‘EPERM’,
npm ERR! path: ‘C:\Users\TheGriz\AppData\Roaming\npm-cache\xtend\4.0.1\package\package.json’,
npm ERR! parent: ‘through2’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! C:__source\donejs\donejs-chat\npm-debug.log
Error: Command npm did not complete successfully
at ChildProcess. (C:\Users\TheGriz\AppData\Roaming\npm\node_modules\donejs\lib\utils.js:45:23)
at ChildProcess.emit (events.js:110:17)
at ChildProcess.cp.emit (C:\Users\TheGriz\AppData\Roaming\npm\node_modules\donejs\node_modules\cross-spawn-a
sync\lib\enoent.js:37:29)
at Process.ChildProcess._handle.onexit (child_process.js:1075:12)

Just to make sure, you removed the old app before re-initing?

I renamed the original folder to donejs-chat,bak before running the cache clean & init commands.

I uninstalled/reinstalled Node…
Removed all existing project folders…
Then installed DoneJs…

During donejs init donejs-chat, it display the following files:

C:__source\donejs\donejs-chat
└── generator-donejs@0.6.3

? Project name donejs-chat
? Project main folder src
? Description
? Project homepage url
? GitHub username or organization
? Author’s Name
? Author’s Email
? Author’s Homepage
? Application keywords
? NPM version used 3
Writing package.json v0.6.5
create package.json
create readme.md
create documentjs.json
create .gitignore
create build.js
create production.html
create development.html
create src\test.html
create src\app.js
create src\index.stache
create src\index.md
create src\styles.less
create src\test\test.js
create src\test\functional.js
create src\models\fixtures\fixtures.js
create src\models\test.js

Looks like the YO file is still missing…

YO doesn’t need to exist in latest.

I think I have a work around…

Downloaded from Git: place-my-order

Copied the ,yo-rc.json file from the downloaded project over to donejs-chat.
Then updated it with the following content:

{
“generator-donejs”: {
“folder”: “src”,
“name”: “donejs-chat”
}
}

Afterwards, I was able to run the add component command successfully.

C:__source\donejs\donejs-chat>donejs add component home.component chat-home
create src\home.component

How can I check/retrieve the latest generator version?

Verified donejs add component works:

  • on my mac
  • with npm cache clean
  • with no yo-rc.

Will try my win 10 machine next.

Thanks for the assistance today!!
Nothing like working on a Saturday…

donejs init should always install the latest version of everything compatible with the getting started guides. Depeding on your version of NPM, how it’s configured, sometimes it uses a cached version, so it won’t install latest. However, a npm cache clean should always fix that.

So to be confident of getting the latest of everything you should just have to do:

npm cache clean
donejs install -g donejs
donejs init

But really, donejs init is all you really should have to do.

when you ran donejs init did you run it as admin? I am seeing permission errors. Might want to try running it as an administrator.

verified that:

  • node 0.12.9
  • on win 10

works. I didn’t have to run the administrator console, but if you see permission errors again, I’d try it out.