Lydon
Lydon

Reputation: 2975

Yeoman angular app npm install error not working

I've searched far and wide for a solution to this but can't seem to find an answer. I've used Yeoman scaffolding many times before on my old Windows 8 PC but I can't get it working on my new Windows 8 PC.

I'm trying to scaffold an angular app using Yeoman. I did the following:

> npm install --global npm
> npm install --global yo bower grunt-cli
> npm install --global generator-angular
> mkdir mytodo && cd mytodo
> npm --version && yo --version && bower --version && grunt --version

2.5.1
1.4.6
1.4.1
grunt-cli v0.1.13
grunt v0.4.5

> yo angular

It runs up to the point where it runs bower install & npm install then shows a whole heap of errors. This is in the npm-debug.log file.

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose config Skipping project config: C:\Users\melon/.npmrc. (matches userconfig)
6 error install Couldn't read dependencies
7 verbose stack Error: ENOENT, open 'C:\Users\melon\package.json'
7 verbose stack     at Error (native)
8 verbose cwd C:\Users\melon
9 error Windows_NT 6.2.9200
10 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
11 error node v0.12.1
12 error npm  v2.5.1
13 error path C:\Users\melon\package.json
14 error code ENOPACKAGEJSON
15 error errno -4058
16 error package.json ENOENT, open 'C:\Users\melon\package.json'
16 error package.json This is most likely not a problem with npm itself.
16 error package.json npm can't find a package.json file in your current directory.
17 verbose exit [ -4058, true ]

What I find interesting in the errors is that it is referring to "C:\Users\melon\package.json". Shouldn't it be looking in the project folder for package.json (which is c:\projects\mytodo)?

Another weird thing is that it is putting a folder called node_modules inside C:\Users\melon\node_modules. This folder contains grunt, grunt-karma, jasmine-core, karma and karma-jasmine. I already have the node_modules folder in C:\Users\melon\AppData\Roaming\npm\node_modules\

If I run the following manually, it installs successfully.

> bower install

If I run the following manually, it fails.

> npm install

[email protected] postinstall C:\Projects\mytodo\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
> node lib/install.js

module.js:338
    throw err;
          ^
Error: Cannot find module 'C:\Users\melon\lib\install.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

...........

Here is some relevant PATH details:

PATH=C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Ruby193\bin;C:\ant\bin;C:\Users\melon\AppData\Roaming\npm

I hope this is enough information for someone to show me where I have gone wrong. Thanks in advance.

Upvotes: 0

Views: 865

Answers (1)

Joram
Joram

Reputation: 64

Since I can not comment yet (need 50 rep.), I'm posting this as an answer.

  • Run Node.js as admin. This often helps a lot with those kind of errors.
  • Your PATH variable is correct (Ruby is there, so is Git).
  • I suggest you try npm install -g bower first because there seems to be something wrong with the package.

Have you already tried another generator (e.g. webapp)?

Upvotes: 2

Related Questions