npm deprecated package problem, npm audit fix --force can not run - npm

$ npm --version
8.0.0
$ npm i uncss -g
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 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
changed 115 packages, and audited 116 packages in 2s
4 packages are looking for funding
run `npm fund` for details
1 moderate severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
I got the above warnings. But I can not fix it as shown below. How to fix it?
$ npm audit fix --force
npm WARN using --force Recommended protections disabled.
npm ERR! code ENOLOCK
npm ERR! audit This command requires an existing lockfile.
npm ERR! audit Try creating one first with: npm i --package-lock-only
npm ERR! audit Original error: loadVirtual requires existing shrinkwrap file
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/myuser/.npm/_logs/2022-07-23T03_14_54_574Z-debug.log

Related

I cant install node modules in react native ,and I get a error message, how can i fix this?

After installing some packages I stumbeled against this error, and I dont know how to fix this:
I hope someone knows how to get this cleaned up, I dont care if I have to install all the packages again.
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command C:\Program Files\nodejs\node.exe C:\Users\muziek\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js install --force --cache=C:\Users\muziek\AppData\Local\npm-cache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! > #expo/vector-icons#13.0.0 prepare
npm ERR! > expo-module prepare && npm run generate-lazy && npm run copy-vendor
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN deprecated set-value#0.4.3: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm ERR! npm WARN deprecated mixin-deep#1.3.1: Critical bug fixed in v2.0.1, please upgrade to the latest version.
npm ERR! npm WARN deprecated set-value#2.0.0: Critical bug fixed in v3.0.1, please upgrade to the latest version.
npm ERR! 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 ERR! npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm ERR! npm WARN deprecated har-validator#5.1.3: this library is no longer supported
npm ERR! npm WARN deprecated request-promise-native#1.0.7: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm ERR! npm WARN deprecated chokidar#2.1.2: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm ERR! npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! npm WARN deprecated w3c-hr-time#1.0.1: Use your platform's native performance.now() and performance.timeOrigin.
npm ERR! npm WARN deprecated source-map-url#0.4.0: See https://github.com/lydell/source-map-url#deprecated
npm ERR! npm WARN deprecated left-pad#1.3.0: use String.prototype.padStart()
npm ERR! npm WARN deprecated debug#4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! npm WARN deprecated debug#3.2.6: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm ERR! npm WARN deprecated sane#2.5.2: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm ERR! npm WARN deprecated request#2.88.0: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! npm WARN deprecated source-map-resolve#0.5.2: See https://github.com/lydell/source-map-resolve#deprecated
npm ERR! npm WARN deprecated uuid#3.3.2: 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 ERR! npm WARN deprecated mkdirp#0.5.1: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
npm ERR! npm WARN deprecated core-js#2.6.5: core-js#<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm ERR! C:\Users\muziek\AppData\Local\npm-cache\_cacache\tmp\git-clone9p2w60\node_modules\expo-module-scripts\bin\expo-module-prepare:3
npm ERR! set -eo pipefail
npm ERR! ^^^^^^^^
npm ERR!
npm ERR! SyntaxError: Unexpected identifier
npm ERR! at Object.compileFunction (node:vm:352:18)
npm ERR! at wrapSafe (node:internal/modules/cjs/loader:1031:15)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1065:27)
npm ERR! at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:981:32)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
npm ERR! at node:internal/main/run_main_module:17:47
npm ERR! npm ERR! code 1
npm ERR! npm ERR! path C:\Users\muziek\AppData\Local\npm-cache\_cacache\tmp\git-clone9p2w60
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c expo-module prepare && npm run generate-lazy && npm run copy-vendor
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! C:\Users\muziek\AppData\Local\npm-cache\_logs\2023-01-09T08_48_36_983Z-debug-0.log
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\muziek\AppData\Local\npm-cache\_logs\2023-01-09T08_48_13_969Z-debug-0.log
Try deleting the node_modules directory and running npm install again. This will force npm to reinstall all of the dependencies, which might fix the problem.
If that doesn't work, you might want to try deleting the package-lock.json file and running npm install again.
If none of these steps help, you can try running npm install --force. However, using the --force flag can also cause problems if it causes npm to overwrite or delete files that are needed for your project to work correctly. It's generally a good idea to use the --force flag only as a last resort, after other methods of fixing the problem have been tried.
Try this,
run npm cache clean --force
Delete node_modules like $ rm -rf node_modules also delete package-lock.json
Install fresh packages npm install
Start the application npm start
Let us know your feedback.
Thanks

issues with installing react native, npm install -g expo-cli gives warnings

I'm trying to install Expo CLI to set up the development environment for React Native but I keep getting this warning when I enter "npm install -g expo-cli" into my terminal:
npm WARN EBADENGINE required: { node: '>=12 <=16' },
npm WARN EBADENGINE current: { node: 'v18.2.0', npm: '8.9.0' }
Previously, trying to install Expo CLI with npm would throw errors like
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/expo-cli
npm ERR! dest /usr/local/lib/node_modules/.expo-cli-dKBr48UN
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/expo-cli',
npm ERR! dest: '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
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.
Then I tried the NVM solution in this post which asked me to uninstall node and then install NVM so that doing things like writing in my npm directory wouldn't ask for permission, but now I'm unsure what to do.
edit:
I followed this website to change my node version to v14.19.3 but now there are these warnings:
npm WARN deprecated subscriptions-transport-ws#0.9.8: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
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 svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
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 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer 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.
/Users/zoeylee/.nvm/versions/node/v14.19.3/bin/expo -> /Users/zoeylee/.nvm/versions/node/v14.19.3/lib/node_modules/expo-cli/bin/expo.js
/Users/zoeylee/.nvm/versions/node/v14.19.3/bin/expo-cli -> /Users/zoeylee/.nvm/versions/node/v14.19.3/lib/node_modules/expo-cli/bin/expo.js
npm WARN ajv-keywords#3.5.2 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
I'm a new user and programmer so any advice/help is appreciated, thanks!
You are using 18.2.0, but the message says it requires >=12 <=16 (greater than 12 and less than 16. Not 18.2.0 or greater.
If it's your package.json with the engines field causing this issue, change it to say 12.0.0 or greater:
"engines": {
"node": ">=12.0.0"
},

"npm start" wont work after "create-react-app"

I have tried everything. Looking at "PATH" variable in windows 10
-reinstalled node multiple times and multiple versions
-removed all node files and npm files from the program folder and the AppData and user folder.
-I finally got the react app to work but then when every I do "npm start" it gives me the errors.
-I have deleted node modules and package-lock.json file as well and still no solution.
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1> npm start
> maryam1#0.1.0 start
> react-scripts start
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Imran\Desktop\zertomastery\19_react\maryam1
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
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! C:\Users\Imran\AppData\Local\npm-cache\_logs\2021-07-18T18_17_31_571Z-debug.log-debug.log
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1>
I have deleted the node_modules folder and the package-lock.json and done npm install
-results of npm install after deleting node_modules and package.json.
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1> npm start > npm install
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/topo#3.1.6: This version has
been deprecated and is no longer supported or maintained act\maryam1
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.co find a file.om/lydell/resolve-url#deprecated
npm WARN deprecated querystring#0.2.1: The querystring
API is considered Legacy. new code should use the URLSearchParams API instead. 18_17_31_571Z-debug.log
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will bregs\2021-07-18Tak on node v14+. Upgrade to chokidar 3 with 15x less dependencies. >
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 querystring#0.2.0: The querystring
API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated sane#4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm
install #sideway/address'
npm WARN deprecated babel-eslint#10.1.0: babel-eslint is now #babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated rollup-plugin-babel#4.4.0: This package has been deprecated and is no longer maintained. Please use #rollup/plugin-babel.
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 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 #hapi/hoek#8.5.1: This version has
been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js#2.6.12: core-js#<3.3 is no
longer maintained and not recommended for usage due to
the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a
slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of
core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\core-js
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
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! C:\Users\Imran\AppData\Local\npm-cache\_logs\2021-07-18T18_22_24_801Z-debug.log
PS C:\Users\Imran\Desktop\zertomastery\19_react\maryam1
after doing allot of commands and things I am not getting this when do "npm start" I switched to bash
Imran#DESKTOP-3331IKE MINGW64 ~/Desktop/zertomastery/19_react/maryam1 (main)
$ npm start
> maryam1#0.1.0 start
> react-scripts start
node:internal/modules/cjs/loader:355
throw err;
^
Error: Cannot find module 'C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\loader-runner\lib\LoaderRunner.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:347:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:560:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:913:27)
at Function.Module._load (node:internal/modules/cjs/loader:772:27)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object.<anonymous> (C:\Users\Imran\Desktop\zertomastery\19_react\maryam1\node_modules\webpack\lib\NormalModule.js:16:36)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\Imran\\Desktop\\zertomastery\\19_react\\maryam1\\node_modules\\loader-runner\\package.json',
requestPath: 'loader-runner'
}
Imran#DESKTOP-3331IKE MINGW64 ~/Desktop/zertomastery/19_react/maryam1 (main)
$
Try This,
npm cache clean
npm install
npm start

permission needed to install serverless via npm

I am trying to install serverless via npm (npm install -g serverless) but get the following error:
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/serverless
npm ERR! dest /usr/local/lib/node_modules/.serverless-Ls3sFIzE
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/serverless' -> '/usr/local/lib/node_modules/.serverless-Ls3sFIzE'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/serverless' -> '/usr/local/lib/node_modules/.serverless-Ls3sFIzE'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/serverless',
npm ERR! dest: '/usr/local/lib/node_modules/.serverless-Ls3sFIzE'
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.
Does anyone know how to do this without having to switch the node versions you're using?
EDIT:
When I run this with sudo I get the following output:
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 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 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 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 uuid#3.3.2: 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
changed 672 packages, and audited 673 packages in 25s
50 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
However, when I try to run serverless invoke local --function f1 I get zsh: command not found: serverless - after I install with sudo what do I need to do so that the command is recognised?
Your permissions are goofed. Speaking generally, you don't want to install anything from npm with sudo.
You can sudo chown yourUser:yourGroup -R /usr/local/lib/node_modules.
(If you're on macOS, your group is probably staff. You can find your group by running ls -l in your home directory and looking at the label adjacent to your username)
A simple alternative is a best practice anyway - install the serverless framework as a development dependency of your project:
npm i -D serverless
And then instead of running serverless deploy you can run npx serverless deploy.
Then as you check in the package.json file to version control, other collaborators will use the same version of the serverless framework.

cb() never called! when installing #vue/cli

Newbie here, I am trying to install vue cli for frontend development with npm, but it is throwing an error.
Here is the output of sudo npm install -g #vue/cli
[18:00 vue]$ sudo npm install -g #vue/cli
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
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 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! /root/.npm/_logs/2021-01-18T13_06_37_662Z-debug.log
Here is a complete log
I tried with and without sudo, the same error.
My machine runs Manjaro KDE 20.2, npm version 6.14.9, node v15.4.0. I have tried:
retrying to see if it works this time
sudo npm cache verify and sudo npm cache clean --force
removing /usr/lib/node_modules
reinstalling node and npm
anything else i found on the internet
I'm stuck on this error for a few days, any help is appreciated.
It's interesting that it works without -g flag, installing to current folder, but I can't figure out how to use vue command then.
Okay, i removed that Manjaro, and grabbed the latest version of ubuntu, this solved my problem, will never install Manjaro again.