remoteinterview / zero

Zero is a web server to simplify web development.
https://zeroserver.io/
Apache License 2.0
5.84k stars 243 forks source link

additional install instructions (root install with npm 6.8.0) #24

Open martinjackson opened 5 years ago

martinjackson commented 5 years ago

This error appeared when attempting installing zero on WSL Ubuntu 18.04 (Windows Subsystem for Linux) on Windows 10. Is this a WSL only problem? Is this an npm 6.8.0 problem?

I think this can be resolved by adding an asterisk and footnote to the install section.

Example:

sudo -i
npm config set unsafe-perm=true
npm install -g zero  

Problem:

sudo npm install -g zero
-- or --
sudo -i
npm install -g zero

... [section shortened]

node-sass@4.11.0 install /usr/lib/node_modules/zero/node_modules/node-sass > node scripts/install.js Unable to save binary /usr/lib/node_modules/zero/node_modules/node-sass/vendor/linux-x64-64 : { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/zero/node_modules/node-sass/vendor'

Solution:

sudo -i
npm config set unsafe-perm=true
npm install -g zero  

... [section shortened]

abritinthebay commented 5 years ago

This isn't a bug. It's a giant security feature of npm. If you're bypassing this you're introducing security flaws and Zero absolutely should never, ever, recommend this incredibly dangerous behavior.

asadm commented 5 years ago

I think I looked into this and as far I remember Zero needs to install node-sass which needs to mkdir some folders in global npm directory (which is owned by root) but npm runs npm install with a different user (nobody I think).

So as of now, the least unsecure method to install zero globally under root is: npm install --unsafe-perm -g zero

Is there a better way?

wlad commented 3 years ago

npm version: 6.14.11 npm install -g zero

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated bson@1.0.9: Fixed a critical issue with BSON serialization documented in CVE-2019-2391, see https://bit.ly/2KcpXdo for more details
npm WARN checkPermissions Missing write access to /usr/local/lib
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/zero/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @mdx-js/parcel-plugin-mdx@1.6.22 requires a peer of @mdx-js/react@^1.6.17 but none is installed. You must install peer dependencies yourself.

npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  [Error: EACCES: permission denied, access '/usr/local/lib'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/wlad/.npm/_logs/2021-02-22T10_38_35_030Z-debug.log

:warning: Thus stuck at getting started :disappointed:. How to proceed?

slavos1 commented 3 years ago

Was same here and followed Getting Started.

However, got unstuck by not using sudo. :star_struck: