Skip to content

Failed to build zopfli (was: Installation failed on Ubuntu 16.04LTS with Node 7.0.0 and npm 3.10.9) #3027

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

Closed
koalabi opened this issue Nov 5, 2016 · 6 comments

Comments

@koalabi
Copy link

koalabi commented Nov 5, 2016

Please provide us with the following information:

OS?

Ubuntu 16.04LTS

Versions.

ng claims to be installed but outputs undefined to 'ng --version' (node --version : 7.0.0)

Repro steps.

"ng new" fails silently: no error message but no file (nor directory) creation.

The log given by the failure.

(No log: absolutely no output, despite 'which ng' yielding '/usr/local/bin/ng' :-()

Mention any other details that might be useful.

Installation emitted several warning (deprecations) and errors when attempting to compile native extensions (maybe due to the unavoidable sudo under Ubuntu for "npm install ... -g"?). Problem is compounded by the fact that reinstalling or uninstalling/reinstalling does not seem to trigger compilation attempts again; so I'm stuck.

Output from very first installation attached below:
ng-cli.install.log-1.txt


Thanks! We'll be in touch soon.

@koalabi
Copy link
Author

koalabi commented Nov 5, 2016

UPDATE: short of anything better, I followed the procedure described for manual upgrades of beta (uninstall, clean cache, reinstall), while being root (sudo bash). Now, ng seems to be installed and at least partially running (will check further) but the build errors for native extensions remain (see attached file for details).

--- start log excerpt ---

node install.js

[execsync v1.0.2] Attempting to compile native extensions.
[execSync v1.0.2]
Native code compile failed!!

[email protected] install /usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://node-zopfli.s3.amazonaws.com/Release/zopfli-v2.0.1-node-v51-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v51 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/home/alain/.node-gyp/7.0.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/.node-gyp"
make: Entering directory '/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/build'
make: *** No rule to make target '../.node-gyp/7.0.0/include/node/common.gypi', needed by 'Makefile'. Stop.
make: Leaving directory '/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-45-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64/zopfli.node" "--module_name=zopfli" "--module_path=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64"
gyp ERR! cwd /usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli
gyp ERR! node -v v7.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64/zopfli.node --module_name=zopfli --module_path=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/angular-cli/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.0-45-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/angular-cli/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli
node-pre-gyp ERR! node -v v7.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/angular-cli/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64/zopfli.node --module_name=zopfli --module_path=/usr/local/lib/node_modules/angular-cli/node_modules/node-zopfli/lib/binding/node-v51-linux-x64' (1)
ng-cli.install.log-2-OK.txt
--- end log excerpt ---

@koalabi koalabi changed the title Installation failed on Ubuntu 16.04LTS with Node 7.0.0 and npm 3.10.9 Failed to build zopfli (was: Installation failed on Ubuntu 16.04LTS with Node 7.0.0 and npm 3.10.9) Nov 5, 2016
@filipesilva
Copy link
Contributor

The native extension build errors can be safely ignored. As long as npm install -g angular-cli does not exit with an error code, it should be installed correctly. Any node-gyp or node-pre-gyp errors are the result of optional installs (at least usually).

Sudo should be avoided, see here https://docs.npmjs.com/getting-started/fixing-npm-permissions. That was probably the reason for your errors from the start.

@JanStureNielsen
Copy link

@koalabi -- see http://stackoverflow.com/questions/39812448/angular-cli-installation-failure

@koalabi
Copy link
Author

koalabi commented Nov 5, 2016

OK, noted. Thanks to both :-)

@jb-ertw
Copy link

jb-ertw commented Dec 8, 2016

(Duplicating my comment on #3214)

For those who are still wondering...

The issue in most cases is that the node-zopfil package needs to be locally compiled on most systems, and it requires C++11 compilation options.

For those of you on an Ubuntu/Debian distro, this means using a g++ compiler with a version 5.1 or later. If you wish to upgrade the default compiler, follow these steps:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5.1 g++-5.1
sudo rm /bin/usr/g++
sudo ln -s /usr/bin/g++-5 /usr/bin/g++

You will still get some compiler warnings about unused functions, but the overall NPM setup and installation should proceed without error.

@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 6, 2019
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

4 participants