Error installing elm by npm

I’m on Ubuntu 16.04 LTS

# npm install elm -g
/usr/bin/elm -> /usr/lib/node_modules/elm/bin/elm                               
                                                                                
> elm@0.19.0-no-deps install /usr/lib/node_modules/elm                          
> node install.js                                                               
                                                                                
-- ERROR -----------------------------------------------------------------------
                                                                                
I had some trouble writing file to disk. It is saying:                          
                                                                                
Error: EACCES: permission denied, open '/usr/lib/node_modules/elm/bin/elm'      
                                                                                
NOTE: You can avoid npm entirely by downloading directly from:                  
https://github.com/elm/compiler/releases/download/0.19.0/binary-for-linux-64-bit
.gz                                                                             
All this package does is download that file and put it somewhere.               
                                                                                
--------------------------------------------------------------------------------
                                                                                
npm ERR! code ELIFECYCLE                                                        
npm ERR! errno 1                                                                
npm ERR! elm@0.19.0-no-deps install: `node install.js`                          
npm ERR! Exit status 1                                                          
npm ERR!                                                                        
npm ERR! Failed at the elm@0.19.0-no-deps install script.                       
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.                                                              
                                                                                
npm ERR! A complete log of this run can be found in:                            
npm ERR!     /root/.npm/_logs/2019-09-20T14_46_39_334Z-debug.log

Here’s the log:
68 silly install elm@0.19.0-no-deps
69 info lifecycle elm@0.19.0-no-deps~install: elm@0.19.0-no-deps
70 verbose lifecycle elm@0.19.0-no-deps~install: unsafe-perm in lifecycle false
71 verbose lifecycle elm@0.19.0-no-deps~install: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/usr/lib/node_modules/elm/node_modules/.bin:/usr/lib/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
72 verbose lifecycle elm@0.19.0-no-deps~install: CWD: /usr/lib/node_modules/elm
73 silly lifecycle elm@0.19.0-no-deps~install: Args: [ ‘-c’, ‘node install.js’ ]
74 silly lifecycle elm@0.19.0-no-deps~install: Returned: code: 1 signal: null
75 info lifecycle elm@0.19.0-no-deps~install: Failed to exec install script
76 timing action:install Completed in 2124ms
77 verbose unlock done using /root/.npm/_locks/staging-a072192f34a17023.lock for /usr/lib/node_modules/.staging
78 timing stage:rollbackFailedOptional Completed in 8ms
79 timing stage:runTopLevelLifecycles Completed in 2292ms
80 verbose stack Error: elm@0.19.0-no-deps install: node install.js
80 verbose stack Exit status 1
80 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
80 verbose stack at EventEmitter.emit (events.js:209:13)
80 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
80 verbose stack at ChildProcess.emit (events.js:209:13)
80 verbose stack at maybeClose (internal/child_process.js:1021:16)
80 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
81 verbose pkgid elm@0.19.0-no-deps
82 verbose cwd /root
83 verbose Linux 4.15.0-64-generic
84 verbose argv “/usr/bin/node” “/usr/bin/npm” “install” “elm” “-g”
85 verbose node v12.10.0
86 verbose npm v6.10.3
87 error code ELIFECYCLE
88 error errno 1
89 error elm@0.19.0-no-deps install: node install.js
89 error Exit status 1
90 error Failed at the elm@0.19.0-no-deps install script.
90 error This is probably not a problem with npm. There is likely additional logging output above.
91 verbose exit [ 1, true ]

Here’s my system info:
# nodejs --version
v12.10.0
# npm --version
6.10.3

Hi @z4k4ri4!

I suspect you’re running into this error because you would need sudo access to modify the target install folder. To be clear, that’s NPM’s problem.

You should be able to solve it doing one of the following:

Well I run it using root.

Pada tanggal Sab, 21 Sep 2019 12.04, Sidney Nemzer via Elm elm_lang@discoursemail.com menulis:

Some helpful fellow on Slack point me to this docs

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

And it help me solve the problem

1 Like

I’m sorry you ran into this trouble!

In the future, I am going to be pointing Linux folks to these instructions for installation.

We have had continuous problems with the npm installer, which is surprising considering that all it needs to do is download a file. I am told that lots of people like having an npm installer if they have some JS based build system, so it will stick around, but I am hopefull that providing a path that does not use npm at all will have better outcomes for people new to Elm.

2 Likes

Have had similar problem. I’ve been wondering why I have this problem only with Elm package. Can it be that the problem isn’t with npm?

No, its an npm problem, that is why they put the solution on an npmjs.com page:

I guess not all npm packages need whatever permission they don’t get but some do.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.