how to solve error code 1 when running npm - npm

I am using Visual Studio Code on MacOS latest version.
I am getting many errors when I try to run npm start that I have posted in a separate question here:
unable to solve error code 1 when running"npm install"
I thought to install all possible modules again to solve the issue when I try to run:
npm i -g npm
I even get errors that part of that is copied here:
ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/local/lib/node_modules/node/bin/node
/usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --
cache=/Users/afshinshahpari/.npm --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! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old
version of npm,
npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the
registry.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
npm ERR! npm WARN old lockfile
npm ERR! npm WARN deprecated fsevents#1.2.11: fsevents 1 will break on node v14+ and
could be using insecure binaries. Upgrade to fsevents 2.
I tried to fix the issue using this article:
npm ERR! git dep preparation failed when trying to install package.json
but when running "npm audit fix" i get a new set of errors:
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/afshinshahpari/.npm/_logs/2021-08-16T12_46_15_639Z-debug.log
in order to solve it, I used
npm i --package-lock-only
but no success.

Here's the solution bro try this.
Step 1:
$ npm cache clean --force
Step 2
Delete node_modules by
$ rm -rf node_modules package-lock.json folder
or delete it manually by going into the directory and right-click > delete / move to trash. Also, delete package-lock.json file too.
Step 3
npm install
To start again,
$ npm start
This worked for me. Hopes it works for you too.
PS: If it is still there, kindly check the error it is displaying in red and act accordingly. This error is specific to Node.js environment.

Related

Got errs with puppeteer and node-sass running npm i

I have a double problem.
The work environment is in Vue and Nuxt, with a mac M1 pro.
Until last week, I had no problems, everything was running perfect. They changed my mac and the world stopped running.
I download 2 repos, but when running npm i, one explodes with puppeteer and the other with node-sass.
npm ERR! code ELIFECYCLE npm ERR! error 1 npm ERR! puppeteer#8.0.0 install:nodeinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer#8.0.0 install script.
npm ERR! code ELIFECYCLE npm ERR! error 1 npm ERR! node-sass#4.14.1 postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass#4.14.1 postinstall script.
I am using the correct version of Node.
I tried deleting the package-lock.json and the node_modules, clearing the npm cache, and running npm i again, and no, it breaks.
I tried installing those specific packages outside of npm i, and I get the same error.
I tried creating a .npmrc file with
registry=https://registry.npmjs.org always-auth=true //registry.npmjs.org/: "token"
I am using the same package.json and the same repos as my peers. They also have mac M1 and have no problem.
On Github we have the same permissions.
Any idea what is happening?
Thank you very much in advance \o/
You can use sass instead of node-sass. This is because node-sass has been deprecated.
npm uninstall node-sass
npm install sass
Works all the same, no need to make any other changes

I am not able to install npm packages on my vaadin project

happy new year!
Any package that I am trying to install I am getting this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #rollup/pluginutils#3.1.0
npm ERR! Found: dev #rollup/plugin-typescript#"^3.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev #rollup/plugin-typescript#"^3.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 ~/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! ~/.npm/_logs/2022-01-02T16_54_42_026Z-debug.log
I am trying to use this npm install --save #fortawesome/fontawesome-free
I don't understand what could be wrong.
as it said in the error, you are handling an old package dependency and therefore you can use --force, or --legacy-peer-deps
Another solution that worked for me, and I think is better, try to install it through pnpm, as it seems to handle it.
I will guess you have decided to update npm itself recently on your local env.
if you run the following (as per your error message), it should install dependencies without trouble.
npm i --legacy-peer-deps
Running npm v8+ to update your dependencies will upgrade the version of your package-lock.json. The issue is that your repo libraries have many old dependencies which might not be compatible with this update. When you run npm with --legacy-peer-deps it uses the old ways...
I have encountered similar problems. After checking, I found that the primary group permission of the node program home directory is 500.500, which needs to be set to root root
Did you try this :
sudo npm install --save #fortawesome/fontawesome-free

unable to solve error code 1 when running"npm install"

when I try to run "npm install" I get errors that I have brought parts of them here:
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/local/lib/node_modules/node/bin/node
/usr/local/lib/node_modules/npm/bin/npm-cli.js install --force --
cache=/Users/afshinshahpari/.npm --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! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old
version of npm,
npm ERR! npm WARN old lockfile so supplemental metadata must be fetched from the
registry.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile This is a one-time fix-up, please be patient...
npm ERR! npm WARN old lockfile
npm ERR! npm WARN deprecated fsevents#1.2.11: fsevents 1 will break on node v14+ and
could be using insecure binaries. Upgrade to fsevents 2.
after reading few articles , I used many commands like this:
npm cache clean --force
or
npm i --package-lock-only
But none of them fixed the issue, even some of them like "npm audit fix --force" showed other types of errors.
Any advice would be appreciated.
What version of node and npm are you using?
I had the same error, spent hours Googling and trying the same things...
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
The error remained...
I ended up downgrading my version of npm to 6.14.15. I was using the latest version of npm which I believe is 7.something. I downgraded to 6.14.15 because that's the one that comes in the stable node.js download.
I don't have the details on why it worked or what's different in the versions but running npm i worked for me after downgrading.
I had same issue
try this, it will solve the issue
npm cache clean --force
rm -rf node_modules
rm -rf package-lock.json
npm install -g npm#6.14.15
npm i

Whenever I run npm install in my terminal, I get "cb() never called"

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! C:\Users\JOVANNE DELA ROSA\AppData\Roaming\npm-cache\_logs\2021-07-16T20_58_48_839Z-debug.log
When we install a node packages from package.json file and package-lock.json file is corrupted due to some reasons like node.js version is updated to the latest, we will see an error like this in our terminal.
To fix this error, first delete the package-lock.json file and run the following command.
npm cache clean --force
Now, try to install your packages using the npm install command.

npm install package.js - can I revert to earlier package?

I am following this tutorial on vue.js on YouTube. One of the packages I installed was eslint 5.5 (which is the current version). I saw this error message:
npm ERR! Failed at the server#1.0.0 lint script 'eslint **/*.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! eslint **/*.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/jason/Documents/vue-movie/server/npm-debug.log
I tried updating Node and NPM, but that did not change this failure. The tutorial is using "^4.6" and I was wondering if there is a way to revert the package I have to an earlier version? And how would I do that?