Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

npm install error #809

Closed
bragith opened this issue May 4, 2016 · 10 comments
Closed

npm install error #809

bragith opened this issue May 4, 2016 · 10 comments

Comments

@bragith
Copy link

bragith commented May 4, 2016

Hi

I'm trying to install FoundationPress, done all the steps and installed all required things for this to work
Current working with node v.4.2.0 but have also tried other versions like v.4.4.3 and other older versions.

My problem starts when i try to run npm install

This is the error I get:

foundationpress@2.6.1 postinstall C:\wamp64\www\wordpress_tutorial\wordpress\wp-content\themes\FoundationPress
bower install && gulp build

'bower' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v4.2.0
npm ERR! npm v2.14.7
npm ERR! code ELIFECYCLE
npm ERR! foundationpress@2.6.1 postinstall: bower install && gulp build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foundationpress@2.6.1 postinstall script 'bower install && gulp build'.
npm ERR! This is most likely a problem with the foundationpress package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! bower install && gulp build
npm ERR! You can get their info via:
npm ERR! npm owner ls foundationpress
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\wamp64\www\wordpress_tutorial\wordpress\wp-content\themes\FoundationPress\npm-debug.log

Appreciate the help
Thanks

@colin-marshall
Copy link
Collaborator

colin-marshall commented May 5, 2016

You need to install bower globally:

npm install -g bower

http://bower.io/#install-bower

@Aetles
Copy link
Contributor

Aetles commented May 9, 2016

Is that really necessary? Because the point of moving to npm run (in 85e631d) was to remove the need for global dependencies of (amongst others) bower.

Or is it a Windows thing, that demands a global version of bower? On OS X at least, I don't have to install it globally and there are arguments made for the move to local dependencies and not using the -g option in articles like this, this and this.

@colin-marshall
Copy link
Collaborator

@Aetles I am totally with you on local vs. global. I just thought that certain dependencies had to be installed globally, but that's probably not so much the case anymore.

So if bower doesn't need to be installed globally, then his problem is that it's not installed locally because it's not being recognized in the path. @bragith run npm install again and see if any errors occur before the one you posted.

@Aetles
Copy link
Contributor

Aetles commented May 9, 2016

Yeah, I can't speak for Windows (maybe there are more hurdles there to keep it local) but the intention of that commit (85e631d) was to make bower local, as the title was removed global dependency of bower and grunt and for me at least I don't need it global.

@colin-marshall
Copy link
Collaborator

colin-marshall commented May 10, 2016

@Aetles I think I found out the reason it is not working. If it's not installed globally, you have to run the bower command instead as ./node_modules/.bin/bower to use the local version. If you want to run the local bower with only the bower command then you have to add this to package.json:

{
    "scripts": {
        "bower": "bower"
    }
}

Adding that to our package.json should tell it to look locally for bower when the command is run.

Source: http://www.sitepoint.com/solve-global-npm-module-dependency-problem/ (See section "The Solution")

@Aetles
Copy link
Contributor

Aetles commented May 10, 2016

It would be interesting to hear if that would solve the issue that OP had.

But it is already working for me without that addition to package.json. I've done a couple of installs recently (of my fork) where node was the only thing I needed to install before running npm install.

@olefredrik
Copy link
Owner

Hi all. Sorry for my absence in recent weeks. Have been busy with duties on other projects. I'm super interested in finding a solution to any installation problems that people experience.

I have two macbooks with OSX and Node v.4.x installed, and the only think I have to do is running npm install and I'm good to go.

I estimate as much as 70-80% of the issues registered on this repo are related to error messages during installation.

@nitrokevin
Copy link

In the past I had loads of installation issues, but things have settled down, my problems boiled down to PATH issues and permission issues. I think the frustrating thing is when something works one day then without an obvious reason it doesn't work the next, for instance I have been using npm run watch on one site for weeks then yesterday I got an error with that and now have to use sudo npm run watch, must be permissions related but I can't track it down. I don't think any of the problems are caused by foundationpress, its just the various versions and ways of installing npm and the locations you use. For me switching to home-brew has made things much better

@colin-marshall
Copy link
Collaborator

colin-marshall commented May 10, 2016

I guess if I had kept reading the article I linked I would have read this:

For example, you shouldn’t necessarily tie your app to Gulp, so you could create scripts that run Gulp, but do not mention Gulp:

{
    ...
    "scripts": {
        "build": "gulp build-prod",
        "develop": "gulp build-dev"
    }
}

So ya it looks like as long you mention bower in the scripts it will run the local version, and so you don't need to have a script "bower": "bower". @Aetles touched on this already, but I misunderstood what she meant. My apologies @Aetles.

So surely something must have went wrong during the install of node_modules for @bragith.

@Aetles
Copy link
Contributor

Aetles commented May 10, 2016

No problem :)

A general advice for troubleshooting these issues is to remove the node_modules folder entirely and run npm install again, that has been useful for me before, when stuck in "dependency hell".

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

No branches or pull requests

5 participants