Error code 1 when installing Angular CLI
This is a bug report.
When trying to install Angular CLI, I'm getting the errors listed below.
This did not happen about 3 weeks ago when I first installed it, but it does now.
OS
OSX El Capitan
Versions
Node v5.2.0 NPM 3.3.12
How I found the error
I simply ran npm i -g --save angular-cli. There were errors about lodash being expired (because a half billion modules use an outdated lodash.) and a reference to padleft that you can see at the top of the log below. For all I know that version of lodash used the leftpad module that caused all the ruckus recently. That's just a guess, but it's breaking the build.
Error
install:lodash.padlef ▌ ╢███████████
postinstall:lodash._baset ▄ ╢█████████
postinstall:npmlog ▐ ╢██████████
postinstall:mime-db → lif ▄ ╢█████████
postinstall:validate-npm- ▌ ╢█████████
> [email protected] postinstall /usr/local/lib/node_modules/angular-cli/node_modules/broccoli
> multidep test/multidep.json
postinstall:underscore.st ▌ ╢█████████
broccoli-plugin 1.0.0: Installing
module.js:329
throw err;
^
Error: Cannot find module 'config-chain'
at Function.Module._resolveFilename (module.js:327:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:355:17)
at require (internal/module.js:13:17)
at Object.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/npm/lib/config/core.js:2:10)
at Module._compile (module.js:399:26)
at Object.Module._extensions..js (module.js:406:10)
at Module.load (module.js:345:32)
at Function.Module._load (module.js:302:12)
at Module.require (module.js:355:17)
Error: npm exited with exit code 1, signal null
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/angular-cli/node_modules/multidep/index.js:90:28)
at emitTwo (events.js:88:13)
at ChildProcess.emit (events.js:173:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:201:12)
postinstall:underscore.st ▌ ╢████████████████
npm WARN install:[email protected] [email protected] postinstall: `multidep test/multidep.json`
npm WARN install:[email protected] Exit status 1
postinstall ▄ ╢█████████████
executeActions → rollback ▄ ╢███████████████████
executeActions → rollback ▌ ╢███████████████████
runTopLevelLifecycles ▌ ╢███████████████████
/usr/local/lib
└── (empty)
runTopLevelLifecycles ▌ ╢████████████████
npm ERR! code 1
I think I tried with and without root... and you can also see this in the logs: npm ERR! Please try running this command again as root/Administrator.
Hey @oYo-fr, I think https://github.com/angular/angular-cli/issues/345#issuecomment-201276673 is spot on. Your issue looks like a permissions issue.
Basically what happens both on OSX and Linux is that once you install any global or local npm package with sudo, you have to install them all.
But in the case of broccolli, it is using multidep to install some extra packages himself - and without sudo.
So the advice for these issues is roughly the same... you need to either change permissions, or remove all the global/relevant local node_modules and reinstall packages without sudo.
Thx for the help...
I've tried the folowwing with Kitematik on Windows (Docker):
- created a new docker container based on official "node" (so I guess, it's a fresh install),
- ran this command right away : npm install -g angular-cli
it failed due to permissions (EACCES) on broccoli :-(
[email protected] postinstall /usr/local/lib/node_modules/angular-cli/node_modules/broccoli multidep test/multidep.json
broccoli-plugin 1.0.0: Installing npm info it worked if it ends with ok npm info using [email protected] npm info using [email protected] npm info attempt registry request try #1 at 8:56:23 AM npm http request GET https://registry.npmjs.org/broccoli-plugin npm http 200 https://registry.npmjs.org/broccoli-plugin npm info retry fetch attempt 1 at 8:56:23 AM npm info attempt registry request try #1 at 8:56:23 AM npm http fetch GET https://registry.npmjs.org/broccoli-plugin/-/broccoli-plugin-1.0.0.tgz npm http fetch 200 https://registry.npmjs.org/broccoli-plugin/-/broccoli-plugin-1.0.0.tgz npm ERR! Linux 4.1.19-boot2docker npm ERR! argv "/usr/local/bin/node" "/usr/local/lib/node_modules/angular-cli/node_modules/.bin/npm" "install" "broccoli- [email protected]" npm ERR! node v5.10.0 npm ERR! npm v2.14.21 npm ERR! path /root/.npm/broccoli-plugin/1.0.0/package npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/broccoli-plugin/1.0.0/package' npm ERR! at Error (native) npm ERR! { [Error: EACCES: permission denied, mkdir '/root/.npm/broccoli-plugin/1.0.0/package'] npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'mkdir', npm ERR! path: '/root/.npm/broccoli-plugin/1.0.0/package' } npm ERR! npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/local/lib/node_modules/angular-cli/node_modules/broccoli/test/multidep/broccoli-plugin-1.0.0/npm-debug
.log
Error: npm exited with exit code 243, signal null
at ChildProcess.
npm ERR! Linux 4.1.19-boot2docker npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "angular-cli" npm ERR! node v5.10.0 npm ERR! npm v3.8.3 npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: multidep test/multidep.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'multidep test/multidep.json'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the broccoli package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! multidep test/multidep.json
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs broccoli
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls broccoli
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /npm-debug.log
I also tried changing de permissions on a brand new container using these commands : chown -R $(whoami) /usr/local/lib/node_modules chown -R $(whoami) /usr/local/bin chown -R $(whoami) /usr/local/share chown -R $(whoami) /root
...with no luck...
I have no other packages installed (at least I guess), as I am starting from scratch with a new docker each time...
Last byt not list : my npm versions are these :
npm -v
3.8.3
node -v
v5.10.0
@oYo-fr from you error log: Please try running this command again as root/Administrator. Did you try that?
Otherwise try fixing npm permissions before installing angular-cli as they suggest here.
I tried as root (see a few commands above). But Anode7 said I should run that as root... Anyway I tried with and without root, always with no success. I also tried to change the folders permissions (see my previous comment): chown -R $(whoami) /usr/local/lib/node_modules chown -R $(whoami) /usr/local/bin chown -R $(whoami) /usr/local/share chown -R $(whoami) /root
without any luck either...
What was the exit status of changing the permissions? Almost sure that chown -R $(whoami) /root won't work just like that, also not sure about previous chowns. Please follow the npm instructions about changing permissions.
You definitely have permissions issue and it is not related to angular-cli.
jkuri, thx for your answer.
I guess all of you are right about the permissions issue. I just don't have any idea about how to fix that easily, and this issue is probably more "broccoli-related" thant "angular-cli" related... but I have tried so many things without any success...
The thing is that even with the explanations given in the tutorial, I'm not able to install that thing as easily as the other npm packages... Probably someone (who?) should try to reproduce that problem. It's really easy : docker + official node image + "npm install -g angular-cli"... I'm quite sad because I wanted so badly to try angular 2 + material 2, but I'm stuck right at the beginning... I probably should wait for all of this to be released for good... Without any clear instructions, I suppose I won't be able (or have the time) to find out how to do that :( Sadly, I think I'll try some other technologies for now, and come back and try again in a few weeks
Not really sure why do you need docker to try angular-cli + material2.
because I just want to understand what I do... If I do all of these commands on my computer every time, maybe one day it will work, but I'll not know why. How could I know that the last command I tried worked on it's own, or because I tried something else one week ago ? At least with docker, I have a clean fresh install each time to run my tests...
Hm... regarding the chown, I noticed the error is in non of those directories...
npm ERR! Error: EACCES: permission denied, mkdir '/root/.npm/broccoli-plugin/1.0.0/package'
Can you maybe try chown recursively on /root/.npm/?
Are you are sure not to throw your docker container in ROOT ? Did you add a user to your docker container ? this user has permissions on the npm directory ? (option2)
@anode7 advice is really good. Check out his recommendation
I found the solution on the official website (EACCES error): https://docs.npmjs.com/getting-started/fixing-npm-permissions
Guys, I uninstalled angular-cli as I had originally installed it globally with sudo. Then, I made sure that the owner permissions were reset correctly so that I did have root access. Then I reinstalled angular-cli without sudo (i.e. npm install -g angular-cli), installation went fine.
Then I try to initiate a new project again (ng new projectName) and I get the same error again.
This is the error:
Error: EACCES: permission denied, open '/Users/username/.config/configstore/ember-cli.json' You don't have access to this file.
What's going on? How do I resolve this? Haven't even reached the point of running 'ng serve' yet....
Also, brew and node and npm were updated.
@n1alloc that file must be a remnant for the old instalation (angular-cli is based on ember-cli). You can delete it.
The solution posted by @anode7 works for me. https://docs.npmjs.com/getting-started/fixing-npm-permissions
https://gist.github.com/developer1011/d6fc9d908c6b3d3100ba1335061cc718
Also it could be an incompatible package for that operating system installed in the node_modules folder. I wanted to run a ng build command on a Linux x64 machine that had the node_modules folder originally uploaded on git from a windows x64 machine. Obviously didn't work. Solution was to remove the node_modules from repository and then re-run the build which obviously now downloaded the correct node_modules.
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.