Closed ktn00b closed 7 years ago
@IndDev thanks for creating the issue.
It looks like this is a duplicate of https://github.com/angular/angular-cli/issues/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)
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:
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.
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.
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
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?
@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?
@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.
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.
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.
@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!
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?
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.
Try Below one--- npm set registry https://registry.npmjs.org/ npm cache clean --force npm cache verify npm install
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.
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.
i have this problem too!
First u have to install file again and must net speed
On Thu 13 Dec, 2018, 4:53 PM sanjeevjh <notifications@github.com wrote:
i have this problem too!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/3906#issuecomment-446934340, or mute the thread https://github.com/notifications/unsubscribe-auth/AqpgBYnLzMYGxtw8pwM5kPqaXtybD4l9ks5u4jizgaJpZM4Ld4Rj .
sudo apt-get --purge remove node-gyp
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.
Try Below one--- npm set registry https://registry.npmjs.org/ npm cache clean --force npm cache verify npm install
babakhalid12 : It's working.. Thanks
i also have problem too
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.
Thanks........
Shubh 8619257539
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.
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:
If I anyway cd into the xyz directory and run npm serve, I get-
I just had a look at installation log, it is full of errors.