npm install error on resolving ionic 3 project error

What I Wanted to Do

I tried to rebuild my ionic 3 project because of the error : : Cannot find module ‘tslib’.

What Happened Instead

I have got Error like followings …

$ npm i
Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/peter/.npm/_cacache/index-v5/69/54’ by manifest.

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/peter/.npm/_cacache/index-v5/69/d6’by manifest.

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/peter/.npm/_cacache/index-v5/69/14’-/is-module-1.0

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/peter/.npm/_cacache/index-v5/69/23’ode_modules/.st

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/peter/.npm/_cacache/index-v5/69/cd’xqLppe4BkWnqSap

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/peter/.npm/_cacache/index-v5/69/68’EalzFjaqH5yNHMv

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/peter/.npm/_logs/2019-02-28T15_00_29_517Z-debug.log

Reproduction Steps

/bin/rm -rf node_modules/* npm install

Details

I have found an error on running my ionic 3 project.

So, I tried to clean up and rebuild.

This is my command history . from my Mac terminal.

10002 ionic cordova run browser
-> Error : Cannot find module ‘tslib’.
10003 ls -al
10004 npm I
-> Error : Cannot find module ‘tslib’.
10005 ionic cordova prepare
-> Error : Cannot find module ‘tslib’.
10006 npm uninstall angular/cli
10007 npm install angular/cli
-> I have got some errors…
$$$ I updated my node npm…
10008 node -v
10009 sudo npm cache clean -f
10010 sudo npm install -g n
10011 sudo n stabe
10012 sudo n stable
10013 node -v
10014 npm -v
10015 sudo npm install -g npm
10016 npm install angular/cli
10017 sudo npm install angular/cli
10018 git ls-remote -h -t ssh://git@github.com/angular/angular-cli
10019 git ls-remote -h -t ssh://peterkhang@github.com/angular/angular-cli
10020 npm install @angular/cli
10021 /bin/rm -rf node_modules/*
10022 which cordova
10023 npm i

14153 silly decomposeActions finalize typedarray@0.0.614154 silly decomposeActions refresh-package-json typedarray@0.0.6
14155 silly decomposeActions fetch typescript@2.6.2
14156 silly decomposeActions extract typescript@2.6.2
14157 silly decomposeActions preinstall typescript@2.6.2
14158 silly decomposeActions build typescript@2.6.2
14159 silly decomposeActions install typescript@2.6.2
23869 silly extract cordova-ios@4.5.5 extracted to /Users/peter/app/sdua/node_modules/.staging/cordova-ios-5f5b7be1 (14
686ms)
23870 silly extract rxjs@6.4.0 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-325e7629 (44060ms)
23871 silly extract rxjs@6.3.3 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-6115430b (43789ms)23872 silly extract rxjs@6.3.3 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-8722b54f (44237ms)
23873 silly extract rxjs@6.3.3 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-258f97ce (43828ms)
23874 silly extract rxjs@6.3.3 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-4656b250 (44183ms)
23875 silly extract rxjs@6.3.3 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-6a3ed031 (44026ms)
23876 silly extract rxjs@5.5.11 extracted to /Users/peter/app/sdua/node_modules/.staging/rxjs-9f0c6a13 (56923ms)
23877 http fetch GET 200 https://registry.npmjs.org/ionic-angular/-/ionic-angular-3.9.2.tgz 57256ms
23878 silly extract ionic-angular@3.9.2 extracted to /Users/peter/app/sdua/node_modules/.staging/ionic-angular-9ea979c7
(57404ms)
23879 timing npm Completed in 69876ms
23880 error cb() never called!
23881 error This is an error with npm itself. Please report this error at:
23882 error https://npm.community

Platform Info

macOs High Sierra
MacBook Pro

$ npm --versions
<!-- paste output here -->

npm --versions
{ sdua: '0.0.1',
  npm: '6.7.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '34.0',
  http_parser: '2.8.0',
  icu: '63.1',
  llhttp: '1.1.1',
  modules: '67',
  napi: '4',
  nghttp2: '1.34.0',
  node: '11.10.1',
  openssl: '1.1.1a',
  tz: '2018e',
  unicode: '11.0',
  uv: '1.26.0',
  v8: '7.0.276.38-node.17',
  zlib: '1.2.11' }

$ node -p process.platform
<!-- paste output here -->
darwin

Long answer with lots of info and links.

The quick work-around is to reset the ownership in the folder you mentioned, before trying the install again:

sudo chown -R $(whoami) ~/.npm

The underlying issue is npm leaving behind some files owned by root, and the canonical open bug is:

A nice way of avoiding the problem is do not use sudo with global installs (or with node installs). If you are planning to install n and use it to install node to /usr/local rather than to your home folder, I wrote up some longer instructions specifically for n. See this comment:

And lastly, I recently promoted my own fork of n if a more modern spin on the same approach is of interest:

2 Likes

I see. I used sudo command.
I change the permission.
Now I have no error : npm install.
Thanks fro your instruction.

But I have got different error .
That’s not npm error but ionic error.

Maybe my ionic 3 project is not compatible with New Ionic command.

1 Like

Good luck with the ionic error.

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