Problem while using generator-loopback with YeoMan

(Rupesh H Bhurke) #1

Hi there!

I am learning loopback & yo. What I was trying to achieve was to use generator-loopback with yo.

OS: Ubuntu 18.04 LTS As guest OS on VirtualBox on WIndows 10.

I did following:

sudo npm install -g yo
sudo npm install -g generator-loopback

above command failed with EACCESS Error for the $HOME/.node-gyp/…

So I tried a few things but all failed till following:

sudo npm install -g generator-loopback -unsafe-perm

Above command installed it properly but now doing following gives me error:

rupesh@rb-ubuntu-minimal:~/nodejs/yeoman$ yo loopback
? What's the name of your application? yo-lb-first
? Enter name of the directory to contain the project: yo-lb-first
   create yo-lb-first/
     info change the working directory to yo-lb-first

? Which version of LoopBack would you like to use? 3.x (Active Long Term Support
)
? What kind of application do you have in mind? hello-world (A project containin
g a controller, including a single vanilla Message and a single remote method)
Generating .yo-rc.json


I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.




Next steps:

  Change directory to your app
    $ cd yo-lb-first

  Create a model in your app
    $ yo loopback:model

  Run the app
    $ node .

Unhandled rejection Error: EACCES: permission denied, open '/home/rupesh/.npm/_cacache/index-v5/be/76/e490dd1bd7fb2cc4742784f6cade235840a8dda24be340d14a8eaab0ee3d'

Unhandled rejection Error: EACCES: permission denied, open '/home/rupesh/.npm/_cacache/index-v5/86/f7/bcdefb0c02ca1069f157f84dd1abbef5a6fa3ff7334e5fd6b29817671406'

Unhandled rejection Error: EACCES: permission denied, open '/home/rupesh/.npm/_cacache/index-v5/14/66/d1c6c3ae4e5d5f97c27c657befb3534ba18b0d5083ab9be325942742e2c7'

Unhandled rejection Error: EACCES: permission denied, open '/home/rupesh/.npm/_cacache/index-v5/38/76/b48f74708dcce83aede20e251aac0daa93f5efd3902c63fc4a91cbdbfba1'

Unhandled rejection Error: EACCES: permission denied, open '/home/rupesh/.npm/_cacache/index-v5/a7/02/2a512783001403565cf7460ec142510337da7589c82f0d17b3f0c10f204a'

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/rupesh/.npm/_cacache/content-v2/sha1/c8/fc'

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!     /home/rupesh/.npm/_logs/2019-03-18T10_49_41_701Z-debug.log
0 Likes

(John Gee) #2

There is an open issue with installing global packages using sudo leaving behind files with the wrong ownership.

The short version is run this to fix the ownership, then try yo again:

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

The long version and canonical bug is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

0 Likes

(John Gee) #3

Also, you mentioned an earlier ownership/permission error in $HOME/.node-gyp/… and probably want to run the chown for that folder too:

sudo chown -R $(whoami) ~/.node-gyp
0 Likes

(system) closed #4

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

0 Likes