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

Angular-cli installs but doesnt start new project: package install failed, see above #3906

Closed
ktn00b opened this issue Jan 9, 2017 · 24 comments

Comments

@ktn00b
Copy link

ktn00b commented Jan 9, 2017

BUILD:
Windows 10
angular-cli: 1.0.0-beta.24
node: 6.9.4
os: win32 x64
npm: 3.10.10

LOG for ng new command

LOG for npm install -g -f angular-cli

I cant start a new project in angular-cli, I get some errors while giving the command "ng new xyz-app"

FYI I uninstalled and re-installed angular-cli using the -f handle, after going through other threads describing a similar issue. That did not help. I also reinstalled node (was on npm 4.0.5 earlier, now on 3.10.10). Error on starting new project is:

Package Install failed, see above.

If I anyway cd into the xyz directory and run npm serve, I get-

You seem to not be dependending on "@angular/core". This is an error.

I just had a look at installation log, it is full of errors.

@beeman
Copy link
Contributor

beeman commented Jan 9, 2017

@inddev thanks for creating the issue.

It looks like this is a duplicate of #2344 , as it seems from your logs that the installation of node-gyp fails, the first error being:

node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\ketanw\AppData\Roaming\npm\node_modules\angular-cli\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\ketanw\AppData\Roaming\npm\node_modules\angular-cli\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64\fse.node --module_name=fse --module_path=C:\Users\ketanw\AppData\Roaming\npm\node_modules\angular-cli\node_modules\fsevents\lib\binding\Release\node-v48-win32-x64' (1)

@ktn00b
Copy link
Author

ktn00b commented Jan 9, 2017

Thanks for the quick reply. I installed that package separately using the command-

npm install -g node-pre-gyp

Then I re-installed angular-cli and tried to initialize a new project. Didnt see an error in angular install but same error in ng new:

angular-cli log

ng new log

The error is:

Package install failed, see above.

Thinking angular-cli reinstall must have fiddled something, I again installed node-pre-gyp and tried ng new again. Still getting the same error message in ng new command.

EDIT- Log after again installing pre-gyp

@celliott181
Copy link
Contributor

celliott181 commented Jan 9, 2017

node-pre-gyp is meant to be installed locally to each project. Uninstall the global and try again without explicitly listing it.

Install

node-pre-gyp is designed to be installed as a local dependency of your Node.js C++ addon...
node-pre-gyp#install

If that doesn't clear it up it may be a permissions issue. Windows isn't 1:1 with the Unix permissions it's most tested under and node-pre-gyp should be used as a Windows Administrator.

@ktn00b
Copy link
Author

ktn00b commented Jan 9, 2017

I uninstalled global node-pre-gyp using the commands
edit- corrected - npm uninstall -g node-pre-gyp

Then I executed the following commands to install the package locally and initialize the angular skeleton-

mkdir xyz 
cd xyz
npm install node-pre-gyp
ng init

I still get the same error. If instead of 'ng init' I had done 'ng new' without installing pre-gyp, I would have still run into the same error. Am I installing node-pre-gyp in an incorrect manner?

EDIT- LOG of ng init

@celliott181
Copy link
Contributor

celliott181 commented Jan 9, 2017

The dependency isn't in your project, but the CLI installations themselves. node-pre-gyp is part of a C++ tool that is required to compile some of the CLI's dependencies. Without these compiling properly, the CLI tools won't function correctly due to errors in their imports.

Did you use a standard or administrator console to install the CLI?

@beeman
Copy link
Contributor

beeman commented Jan 9, 2017

@inddev It might be that your issue is related to node-gyp, not node-pre-gyp.

Can you try to remove and reinstall node-gyp globally?

@ktn00b
Copy link
Author

ktn00b commented Jan 9, 2017

@gelliott181 I used an admin console. Anything related to npm I always make sure it is an admin console.

@beeman I searched online for issues related to node-gyp and it seems to be a sinkhole of issues, way too many people complaining of issues with node-gyp with no clear fix. It seems one way out of that mess is installing VisualCPP Build Tools, which is appx a 4GB install, besides several other smaller fixes.

In my experience, there was no error related to node-gyp when node or even angular was installing, but I do realize that npm contains its own version of node-gyp and prefers to use that instead of that listed in another package's json. Let me figure this out and get back in a couple hours.

EDIT/update- In the first install I did, yes node-gyp errors were there. As @beeman mentioned in his first comment. But those disappeared when I reinstalled everything. I will just give it a global reinstall (once I figure out how to do it) and report back

EDIT2: I also realized that after I uninstall angular, npm and even node, the folder node-gyp persists in AppData/Roaming/Npm/node_modules folder. So before I reinstall everything I will manually remove this folder.

@celliott181
Copy link
Contributor

If that folder was persisting after an install something about the permissions changed causing it to be unusable to NPM and node.

I've yet to see an error about node-gyp under Windows that isn't related to some package mucking around with access rights. That was my reason for bumping node from v6.3 to v6.5 a few months back with a clean reinstall.

@filipesilva
Copy link
Contributor

Your problem does seem to be node-gyp related but there isn't much we can do save for changing dependencies.

I can tell you that the CLI does not require node-gyp to be installed or to run though. Usually packages try to download a binary instead of building, and then fallback to building.

You can try to use the --no-optional flag on npm install, that might help.

@ktn00b
Copy link
Author

ktn00b commented Jan 11, 2017

@filipesilva I first manually removed modules in npm directory, also cleared the cache manually and then also using the command. Then I installed npm v4.1.1 using npm-windows-upgrade. Previously I had also followed the steps for node-gyp on their github page (https://github.com/nodejs/node-gyp).

Installation of angular-cli didnt throw up errors this time. but creating a new project still leads to the same issue:

Package install failed, see above.

When I command ng serve, it says

You seem to not be dependending on "@angular/core". This is an error.

(dependending really?)
At this point of time I really have no idea what to do... I am just trying to learn Angular 2 and just getting past the setup is proving to be quite painful!

@ktn00b
Copy link
Author

ktn00b commented Jan 11, 2017

Just want to add, I have no issues whatsoever when I use the angular-seed project (quickstart). That involved git cloning the quickstart folder, running an npm install and its done. What breaks here in cli?

@Limcap
Copy link

Limcap commented Feb 13, 2017

Hello people. I'm also having the same issue here on a ubuntu 14.04 x64 installed in virtualbox. I installed the @angular/cli globally, had some problems with dependencies missing, but fixed i with the #2704 json.package . However "ng new" always hangs and then fails. any news on this issue?
UPDATE
I found a work around executing ng new --skip-install PROJECT_NAME and then manually going into the created folder and typing npm install. I think it's a permission problem.

@filipesilva
Copy link
Contributor

Fixed by #5282

@babakhalid12
Copy link

Try Below one---
npm set registry https://registry.npmjs.org/
npm cache clean --force
npm cache verify
npm install

@vupendra
Copy link

i getting error please resolve it
npm ERR! A complete log of this run can be found in:
npm ERR! npm-cache_logs\2018-11-14T10_48_21_213Z-debug.log
Package install failed, see above.

@AjayMCA
Copy link

AjayMCA commented Dec 13, 2018

npm ERR! Unexpected end of JSON input while parsing near '...lMYcrBG1gW4ZC4wzYHRd4'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Surajit Roy\AppData\Roaming\npm-cache_logs\2018-12-13T07_18_35_545Z-debug.log
Package install failed, see above.

Facing This kind of issue to open new project.

error

@sanjeevjh
Copy link

i have this problem too!

@vupendra
Copy link

vupendra commented Dec 13, 2018 via email

@breinersn
Copy link

sudo apt-get --purge remove node-gyp

@rajulverma
Copy link

I am also getting this msg..

npm ERR! Unexpected end of JSON input while parsing near '...rma-phantomjs-launche'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2019-02-21T07_21_13_483Z-debug.log
Package install failed, see above.

@rajulverma
Copy link

Try Below one---
npm set registry https://registry.npmjs.org/
npm cache clean --force
npm cache verify
npm install

babakhalid12 : It's working.. Thanks

@trieuquang204
Copy link

i also have problem too

@arunbharmal
Copy link

hello to all...........
I m working on a project based on angular js latest
I developed all my code successfully but when I run it it shows me your project site is under construction.
your convenience is needed and there is no third party enrollment involve.It designed by myself not in any group or with any partner.
help me to comes out from this problem.

error

Thanks........

Shubh
8619257539

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests