node.js - As a centos7 root user, use npm to install yo. Is yo unusable?
世界只因有你
世界只因有你 2017-06-29 10:09:28
0
3
1293

I installed node and npm as root user under centos.
Then install yo,

npm install -g yo



Yeoman Doctor
Running sanity checks on your system

✔ Global configuration file is valid
✔ Node.js version
✔ No .bowerrc file in home directory
✔ No .yo-rc.json file in home directory
✔ npm version
✔ NODE_PATH matches the npm root

Everything looks all right!
+ yo@2.0.0

However, when using yo, an error is reported.

[root@localhost address-book]# yo -v
/root/.node/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:53
                                throw err;
                                ^

Error: EACCES: permission denied, open '/root/.config/configstore/insight-yo.json'
You don't have access to this file.

    at Error (native)
    at Object.fs.openSync (fs.js:641:18)
    at Object.fs.readFileSync (fs.js:509:33)
    at Object.get (/root/.node/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:34:26)
    at Object.Configstore.get (/root/.node/lib/node_modules/yo/node_modules/insight/node_modules/configstore/index.js:81:13)
    at Insight.get (/root/.node/lib/node_modules/yo/node_modules/insight/lib/index.js:48:22)
    at Object.<anonymous> (/root/.node/lib/node_modules/yo/lib/cli.js:194:47)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

Google didn't find the answer either. .
Isn’t it possible to install these with the root user?

世界只因有你
世界只因有你

reply all(3)
phpcn_u1582

You don't have access to this file.
It seems you don't have access to this file

Look at this file permissions.

ls -al /root/.config/configstore/insight-yo.json

Try to reinstall using the following command:

npm install --global yo --allow-root
滿天的星座

I am running Ubuntu and have the same error as the original poster. Someone, please give me the answer. The method of changing access permissions does not work.

我想大声告诉你

See GitHub Issue:

https://github.com/yeoman/yo/...

A feasible method is mentioned here: use NVM processing.

In addition, it is not recommended to use the root user to install the npm package. Various unpredictable problems often occur because you are the root user.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template