I try to install a react project using the command below but it ends me up with the following error:

[email protected]:~/workspace_react$ npm install -g create-react-app
npm WARN checkPermissions Missing write access to /usr/local/lib
npm ERR! path /usr/local/lib
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib']
npm ERR!   stack: "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! 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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/muhammad/.npm/_logs/2019-04-21T16_59_06_953Z-debug.log
[email protected]:~/workspace_react$ 

Here are the versions installed:

[email protected]:~/workspace_react$ node -v
v11.14.0
[email protected]:~/workspace_react$ npm -v
6.7.0

Installed using snap:

sudo snap install node --classic --channel=11

If I ran installation test I end up like this:

[email protected]:~/workspace_react$ curl -sL https://deb.nodesource.com/test | bash -

## Testing Node.js and npm installation ...

+ mkdir _test-node-install && cd _test-node-install

## Creating test package ...


## Installing dependencies ...

+ npm install --spin=false --loglevel=info --cache=.npm-test-cache
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~preinstall: [email protected]
npm http fetch GET 200 https://registry.npmjs.org/through/-/through-2.2.7.tgz 257ms
npm http fetch GET 200 https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz 263ms
npm http fetch GET 200 https://registry.npmjs.org/readable-stream 534ms
npm http fetch GET 200 https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz 266ms
npm http fetch GET 200 https://registry.npmjs.org/string_decoder 269ms
npm http fetch GET 200 https://registry.npmjs.org/core-util-is 286ms
npm http fetch GET 200 https://registry.npmjs.org/isarray 286ms
npm http fetch GET 200 https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz 749ms
npm info lifecycle [email protected]~install: [email protected]
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/1935/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> [email protected] install /home/muhammad/workspace_react/_test-node-install/node_modules/buffertools
> node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp http GET https://nodejs.org/download/release/v11.14.0/node-v11.14.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v11.14.0/node-v11.14.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v11.14.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v11.14.0/SHASUMS256.txt
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/snap/node/1935/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/home/muhammad/workspace_react/_test-node-install/node_modules/buffertools/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/snap/node/1935/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/muhammad/.node-gyp/11.14.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/muhammad/.node-gyp/11.14.0',
gyp info spawn args   '-Dnode_gyp_dir=/snap/node/1935/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/home/muhammad/.node-gyp/11.14.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/home/muhammad/workspace_react/_test-node-install/node_modules/buffertools',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/home/muhammad/workspace_react/_test-node-install/node_modules/buffertools/build'
  CXX(target) Release/obj.target/buffertools/buffertools.o
../buffertools.cc: In member function ‘v8::Local<v8::Value> {anonymous}::FillAction::apply(v8::Local<v8::Object>, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:256:44: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       int c = args[args_start]->Int32Value();
                                            ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:261:43: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
       String::Utf8Value s(args[args_start]);
                                           ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2992:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:266:56: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       Local<Object> other = args[args_start]->ToObject();
                                                        ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In member function ‘v8::Local<v8::Value> {anonymous}::IndexOfAction::apply(v8::Local<v8::Object>, const uint8_t*, size_t, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:329:54: warning: ‘int32_t v8::Value::Int32Value() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
     int32_t start = args[args_start + 1]->Int32Value();
                                                      ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2572:46: note: declared here
   V8_DEPRECATED("Use maybe version", int32_t Int32Value() const);
                                              ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc: In function ‘void {anonymous}::Concat(const v8::FunctionCallbackInfo<v8::Value>&)’:
../buffertools.cc:449:29: warning: ‘v8::Local<v8::String> v8::Value::ToString() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       size += arg->ToString()->Utf8Length();
                             ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10251:15: note: declared here
 Local<String> Value::ToString() const {
               ^
../buffertools.cc:449:43: warning: ‘int v8::String::Utf8Length() const’ is deprecated: Use Isolate version instead [-Wdeprecated-declarations]
       size += arg->ToString()->Utf8Length();
                                           ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2682:52: note: declared here
   V8_DEPRECATED("Use Isolate version instead", int Utf8Length() const);
                                                    ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:452:50: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       size += node::Buffer::Length(arg->ToObject());
                                                  ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc:470:30: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
       String::Utf8Value v(arg);
                              ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2992:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:475:39: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       Local<Object> b = arg->ToObject();
                                       ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::ClearAction]’:
../buffertools.cc:431:1:   required from here
../buffertools.cc:141:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::CompareAction]’:
../buffertools.cc:432:1:   required from here
../buffertools.cc:169:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc:177:43: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
       String::Utf8Value s(args[args_start]);
                                           ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2992:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:187:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       Local<Object> other = args[args_start]->ToObject();
                                                       ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::EqualsAction]’:
../buffertools.cc:433:1:   required from here
../buffertools.cc:169:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc:177:43: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
       String::Utf8Value s(args[args_start]);
                                           ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2992:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:187:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       Local<Object> other = args[args_start]->ToObject();
                                                       ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::FillAction]’:
../buffertools.cc:434:1:   required from here
../buffertools.cc:141:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::FromHexAction]’:
../buffertools.cc:435:1:   required from here
../buffertools.cc:141:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::IndexOfAction]’:
../buffertools.cc:436:1:   required from here
../buffertools.cc:169:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc:177:43: warning: ‘v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
       String::Utf8Value s(args[args_start]);
                                           ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/v8.h:26:0,
                 from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:2992:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/home/muhammad/.node-gyp/11.14.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^
../buffertools.cc:187:55: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       Local<Object> other = args[args_start]->ToObject();
                                                       ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::ReverseAction]’:
../buffertools.cc:437:1:   required from here
../buffertools.cc:141:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
../buffertools.cc: In instantiation of ‘v8::Local<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&) [with Derived = {anonymous}::ToHexAction]’:
../buffertools.cc:438:1:   required from here
../buffertools.cc:141:33: warning: ‘v8::Local<v8::Object> v8::Value::ToObject() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
       target = args[0]->ToObject();
                                 ^
In file included from /home/muhammad/.node-gyp/11.14.0/include/node/node.h:63:0,
                 from ../buffertools.cc:17:
/home/muhammad/.node-gyp/11.14.0/include/node/v8.h:10257:15: note: declared here
 Local<Object> Value::ToObject() const {
               ^
  SOLINK_MODULE(target) Release/obj.target/buffertools.node
  COPY Release/buffertools.node
make: Leaving directory '/home/muhammad/workspace_react/_test-node-install/node_modules/buffertools/build'
gyp info ok 
npm timing audit submit Completed in 1220ms
npm http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 1219ms
npm WARN [email protected] No license field.

added 10 packages from 12 contributors and audited 10 packages in 13.894s
found 0 vulnerabilities

npm timing npm Completed in 14362ms
npm info ok 

## Running test ...

+ npm test
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/1935/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] test /home/muhammad/workspace_react/_test-node-install
> npm start; node test.js

npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/1935/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] start /home/muhammad/workspace_react/_test-node-install
> node server.js &

(node:30416) TimeoutOverflowWarning: 4294967296000 does not fit into a 32-bit signed integer.
Timer duration was truncated to 2147483647.
SUCCESS
(node:30416) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.

## Cleaning up ...

+ rm -rf _test-node-install
[email protected]:~/workspace_react$ 

I am not sure if I am doing anything wrong in terms of installation or configuration but nothing seems to work.

0 Answers