I am trying to install node.js and npm in my laptop using the following commands found here:
# Using Ubuntu
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
These install Node.js LTS (v12.x).
After this, I am trying to install serverless as shown here.
I do:
npm install -g serverless
and it throws the following error
cortex#cortex-Lenovo-ideapad-720S-15IKB:~$ npm install -g serverless
npm WARN deprecated #types/chalk#2.2.0: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need #types/chalk installed!
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 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 checkPermissions Missing write access to /usr/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/serverless/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules'
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/cortex/.npm/_logs/2020-08-19T14_04_41_850Z-debug.log
I am completely new to node.js, so can anyone please help me out with this?
P.S.:
output of node -v is v12.18.3
output of npm -v is 6.14.6
Use sudo when installing a global package.
sudo npm install -g serverless
Related
This is what I am currently receiving when I try to instill.
npm ERR! Unexpected end of JSON input while parsing near '...QoQAJQkmBR37svMSvUbRQ'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mattgranado/.npm/_logs/2021-08-31T02_54_24_892Z-debug.log
(base) mattgranado#Matts-MacBook-Pro ~ %
I did atttempt
npm cache clean --force
but only got this
npm WARN using --force I sure hope you know what you are doing.
npm ERR! Usage: npm cache add <tarball file>
npm ERR! npm cache add <folder>
npm ERR! npm cache add <tarball url>
npm ERR! npm cache add <git url>
npm ERR! npm cache add <name>#<version>
npm ERR! npm cache clean
npm ERR! npm cache verify
Then I attempted
sudo npm cache clean --force
to whom which I got the message below.
npm WARN using --force I sure hope you know what you are doing.
(base) mattgranado#Matts-MacBook-Pro ~ % npm install -g expo-cli
npm WARN deprecated graphql-tools#3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as #graphql-tools/schema, #graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
npm WARN deprecated uuid#3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request#2.88.2: request has been deprecated, 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 resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
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 uuid#3.0.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
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! /Users/mattgranado/.npm/_logs/2021-09-02T02_11_33_424Z-debug.log
I would really appreciate any insight on what may be causing these issues.
I am getting errors trying to run npm install on a node/react app which I am taking over development of.
I'm not trying to install any packages globally. I am on an M1 Macbook Pro running Big Sur. I did a fresh install of node and npm with Homebrew. I also tried removing the package-lock.json file, cleaning the npm cache, and adding a .npmignore file to the directory as some other posts have suggested; none of these worked.
Here is the output when I run npm install
MacBook-Pro-2 frontend % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [my project name]-dashboard#0.1.0
npm ERR! Found: webpack#5.39.0
npm ERR! node_modules/webpack
npm ERR! webpack#"5.39.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^4.0.0" from optimize-css-assets-webpack-plugin#6.0.0
npm ERR! node_modules/optimize-css-assets-webpack-plugin
npm ERR! optimize-css-assets-webpack-plugin#"6.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/<name>/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<name>/.npm/_logs/2021-06-15T17_41_19_910Z-debug.log
I tried to run npm install --legacy-peer-deps, which causes a slightly different error:
MacBook-Pro-2 frontend % npm install --legacy-peer-deps
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/pinpoint#1.0.2: Moved to 'npm install #sideway/pinpoint'
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated #hapi/formula#1.2.0: Moved to 'npm install #sideway/formula'
npm WARN deprecated topojson#3.0.2: Use topojson-client, topojson-server or topojson-simplify directly.
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/joi#16.1.8: Switch to 'npm install joi'
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/Users/<name>/Developer/<directory>/frontend/node_modules/topojson/node_modules/topojson-simplify/bin/toposimplify'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<name>/.npm/_logs/2021-06-15T17_41_57_785Z-debug.log
I solved my own problem. I think this is a common error message, with many potential solutions; here are 2 things I tried that fixed the issue for me:
Make sure you have postgresql installed (if your project includes a postgresql db, like mine). On a mac with homebrew, just run brew install postgresql.
I also downgraded my version of Node.js to the most up-to-date long term support version (previously I was using the dev version). At the time of writing the LTS version was 14.7.
After making these changes, I was able to get my site to install and start correctly.
i was trying to install Netlify-Cli using Linux Terminal.
I tried this command:
npm install netlify-cli -g
But it is throwing some error
> yarn#1.22.10 preinstall /usr/local/lib/node_modules/netlify-cli/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#2.3.2 (node_modules/netlify-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: #netlify/traffic-mesh-agent-win32-x64#0.27.10 (node_modules/netlify-cli/node_modules/#netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for #netlify/traffic-mesh-agent-win32-x64#0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: #netlify/traffic-mesh-agent-darwin-x64#0.27.10 (node_modules/netlify-cli/node_modules/#netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for #netlify/traffic-mesh-agent-darwin-x64#0.27.10: wanted {"os":"darwin","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/netlify-cli/bin/run
npm ERR! dest /usr/local/bin/netlify
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR! { [Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify']
npm ERR! cause:
npm ERR! { Error: EACCES: permission denied, symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/netlify-cli/bin/run',
npm ERR! dest: '/usr/local/bin/netlify' },
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, symlink \'../lib/node_modules/netlify-cli/bin/run\' -> \'/usr/local/bin/netlify\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'symlink',
npm ERR! path: '../lib/node_modules/netlify-cli/bin/run',
npm ERR! dest: '/usr/local/bin/netlify' }
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/silence/.npm/_logs/2021-05-09T13_28_21_198Z-debug.log
If any small help would be helpful.
Thanks to boirslav popov.
As he mentioned in his answer it has worked for some of them ie,
sudo npm install netlify-cli -g
But sadly it didn't work for me :(
For those, if the above command didn't work can follow the attached answer :D
Answer
I followed this answer
i.e,
sudo npm install -g --unsafe-perm=true netlify-cli
See this: https://answers.netlify.com/t/errors-with-netlify-cli/26842
Your user does not have sufficient permissions.
Im using a Mac.
So I actually had to go into my library folder and manually delete the netlify folder.
I then reinstalled the netlify cli via brew:
brew reinstall netlify-cli
This way you dont get all the permissions errors. In general this is seems like the best way to do things on mac when dealing with a cli.
It would be good to know why Mac gets mad at just using the global npm install tho.
while I install (npm i --global #adonisjs/cli) I have an error
$ npm i --global #adonisjs/cli
npm WARN deprecated kleur#2.0.2: Please upgrade to kleur#3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm WARN deprecated set-value#1.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version.
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 resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/lib/node_modules
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/#adonisjs/cli/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 ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/lib/node_modules'
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/afshin/.npm/_logs/2021-03-02T05_09_22_618Z-debug.log
As I saw an error is related to permission. SO you need to execute the command with the help of "sudo" like,
sudo npm i --global #adonisjs/cli
I'm trying to install npm live-server but I am getting the following errors:
stl34>>npm install live-server -g
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 opn#6.0.0: The package has been renamed to `open`
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 resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
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! /Users/stl34/.npm/_logs/2020-08-10T22_30_11_210Z-debug.log
The issue seems to be that the file permissions for /usr/local/lib/node_modules need to be changed.
I tried restarting in recovery mode and typing into the terminal:
csrutil disable
to disable SIP. Then I restarted and entered the following into the terminal:
sudo mount -uw /
chmod 775 usr/local/lib/node_modules
But the system still will not allow me to modify the file permissions. What can I do to modify them?
Another user asked this same question here:
NPM Live-server not installing on zsh
but received no answers.
running "sudo npm install live-server -g" worked for me