NPM package-lock.json causes npm install to fail on Linux - node.js

So I just updated NPM on my Mac and it generated a lock file on a project. "Hey - that's great" I say and commit it. Then my build fails on Travis CI with the following:
Compiling Frontend Assets
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 4.4.0-83-generic
npm ERR! argv "/home/travis/.nvm/versions/node/v7.4.0/bin/node" "/home/travis/.nvm/versions/node/v7.4.0/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! shasum check failed for /tmp/npm-9017-ad78fe01/registry.npmjs.org/hawk/-/hawk-3.1.3.tgz
npm ERR! Expected: 078444bd7c1640b0fe540d2c9b73d59678e8e1c4
npm ERR! Actual: 282a21cacac687357d149e149c408a3c0506695c
npm ERR! From: https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/travis/build/project/npm-debug.log
make: *** [frontend] Error 1
It's a Symfony project but I use NPM for SCSS, JS compiling and copying images and fonts etc to the web directory. I'm projecting that this probably has something to do with differences in packages for OSX & Linux - which I have experienced before with an image processing package.
Or it could be due to the version of NPM that travis is using here?
I have 5.3.0 on my local machine now.
Or is it something I just don't understand about the lock file for npm? Could it be that it's trying to validate the packages installed...
My package.json looks like this. The issue is obviously with a dependency of a dependency. I'm wondering if I should just .gitignore the lock file if it's going to cause this kind of conflict. And I'm not sure if I need to start down the route of making sure all versions of node and npm are identical across all platforms that run builds.
{
"name": "project",
"version": "1.0.0",
"description": "project",
"main": "index.js",
"scripts": {
... front end build scripts
},
... ,
"devDependencies": {
"autoprefixer": "^7.1.2",
"bulma": "^0.5.1",
"chokidar-cli": "^1.2.0",
"cssnano": "^3.10.0",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"jshint": "^2.9.5",
"mkdirp": "^0.5.1",
"node-sass": "^4.5.3",
"npm-run-all": "^4.0.2",
"postcss-cli": "^4.1.0",
"uglifyjs-folder": "^1.1.0"
}
}

Related

How to resolve peer dependency conflict

Thanks for reading.
After testing some changes in my local dev environment and having no issues, I promoted the changes to my test environment hosted on AWS Amplify, and the build was failing with the following error:
2022-11-28T19:47:50.604Z [WARNING]: ERR! ERESOLVE could not resolve
npm ERR!
npm
2022-11-28T19:47:50.605Z [WARNING]: ERR! While resolving: styles#0.2.1
npm ERR! Found: assemble#0.24.3
npm ERR! node_modules/assemble
npm ERR!
2022-11-28T19:47:50.605Z [WARNING]: assemble#"^0.24.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer assemble#"~0.3.11" from styles#0.2.1
npm ERR! node_modules/styles
npm ERR! styles#"^0.2.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: assemble#0.3.83
npm ERR! node_modules/assemble
npm ERR! peer assemble#"~0.3.11" from styles#0.2.1
npm ERR! node_modules/styles
npm ERR! styles#"^0.2.1" from the root project
npm ERR!
npm ERR!
2022-11-28T19:47:50.605Z [WARNING]: 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 /root/.npm/eresolve-report.txt for a full report.
Here are the two dependencies mentioned in the above error, in the package.json file:
"assemble": "^0.24.3",
"styles": "^0.2.1"
Here are the two dependencies mentioned above, in the package-lock file:
"node_modules/styles": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/styles/-/styles-0.2.1.tgz",
"integrity": "sha1-hJJ7pEf6pvJJ7NIK3wu4X606UUE=",
"dependencies": {
"less": "\~1.4.0"
},
"engines": {
"node": "\>= 0.8.0"
},
"peerDependencies": {
"assemble": "\~0.3.11",
"grunt": "\~0.4.0"
}
},
"node_modules/assemble": {
"version": "0.24.3",
"resolved": "https://registry.npmjs.org/assemble/-/assemble-0.24.3.tgz",
"integrity": "sha1-lSp3S3iAl6TW9Iw6QrpW9ouNZS8=",
"dependencies": {
"assemble-core": "^0.31.0",
"assemble-loader": "^1.0.5",
"base-argv": "^0.5.0",
"base-cli-process": "^0.1.19",
"base-config": "^0.5.2",
"base-questions": "^0.9.1",
"base-runtimes": "^0.2.0",
"cross-spawn": "^5.1.0",
"engine-handlebars": "^0.8.2",
"expand-front-matter": "^1.0.0",
"export-files": "^2.1.1",
"global-modules": "^0.2.3",
"is-valid-app": "^0.3.0",
"lazy-cache": "^2.0.2",
"log-utils": "^0.2.1",
"minimist": "^1.2.0",
"parser-front-matter": "^1.6.3",
"resolve-dir": "^1.0.0"
},
"bin": {
"assemble": "bin/cli.js"
},
"engines": {
"node": "\>=4.0"
}
},
I tried running the build with --force, and --legacy-peer-deps, but neither of the two dependencies mentioned above (assemble, and styles) are affected by either operation, and I still have the same issue.
I've tried installing the version of assemble to version 0.3.11 (as listed as the peerDependecy of styles), and again the build in my local environment works, but after promoting to my test environment on AWS Amplify, the build fails with the following errors:
2022-11-28T19:38:40.756Z [WARNING]: npm ERR!
2022-11-28T19:38:40.756Z [WARNING]: code EUSAGE
2022-11-28T19:38:40.760Z [WARNING]: npm
2022-11-28T19:38:40.760Z [WARNING]: ERR!
npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm ERR!
npm ERR! Missing: immutable#4.1.0 from lock file
npm ERR! Missing: seamless-immutable#7.1.4 from lock file
npm ERR! Missing: typescript#4.9.3 from lock file
I also uninstalled assemble and styles, but ran into the same error when trying to build the test environment.
Additionally, I went and looked at my commit history, and the package.json and package-lock.json files haven't been changed in months, and I've had many successful builds since they were last modified, which adds to my confusion of where this problem came from.
Further info:
Local Dev environment is using node v16.13.1 and npm v8.1.2, and Amplify build image (default image) just specifies in the build logs that its using Node version 16
Uninstalling both dependencies and then running npm update resolved my issues

ENOTDIR error on npm install (npm 3 over node 4. I know: legacy. Sorry :( )

First of all, my apologies for reporting a problem of npm3 here, but it looks like the old repo is currently in read only mode.
We have a big and old angularjs frontend app, that requires node4 and uses npm3. A couple of days ago, a problem raised when someone performed a npm install.
error
npm ERR! Linux 4.19.0-13-amd64
npm ERR! argv "/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqq/abc-batch-qqq/node/node" "/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqq/abc-batch-qqq/node/node_modules/npm/bin/npm-cli.js" "install"
npm ERR! node v4.4.3
npm ERR! npm v3.10.10
npm ERR! path /home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqq/abc-batch-qqq/node_modules/.staging/#types/node-69b48d6f/package.json
npm ERR! code ENOTDIR
npm ERR! errno -20
npm ERR! syscall open
npm ERR! ENOTDIR: not a directory, open '/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqq/abc-batch-qqq/node_modules/.staging/#types/node-69b48d6f/package.json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
package.json
{
"name": "abc",
"version": "0.0.0",
"description": "Description for abc",
"private": true,
"cacheDirectories": [
"node_modules",
"src/main/webapp/bower_components"
],
"devDependencies": {
"bower": "1.7.9",
"browser-sync": "2.12.10",
"del": "2.2.1",
"eslint-config-angular": "0.5.0",
"eslint-plugin-angular": "1.3.1",
"event-stream": "3.3.4",
"generator-jhipster": "3.4.2",
"gulp": "3.9.1",
"gulp-angular-filesort": "1.1.1",
"gulp-angular-templatecache": "2.0.0",
"gulp-autoprefixer": "3.1.0",
"gulp-changed": "1.3.1",
"gulp-cssnano": "2.1.2",
"gulp-eslint": "3.0.1",
"gulp-flatten": "0.3.0",
"gulp-footer": "1.0.5",
"gulp-htmlmin": "2.0.0",
"gulp-if": "2.0.1",
"gulp-imagemin": "3.0.2",
"gulp-inject": "4.1.0",
"gulp-natural-sort": "0.1.1",
"gulp-ng-annotate": "2.0.0",
"gulp-ng-constant": "1.1.0",
"gulp-notify": "2.2.0",
"gulp-plumber": "1.1.0",
"gulp-rename": "1.2.2",
"gulp-replace": "0.5.4",
"gulp-rev": "7.1.0",
"gulp-rev-replace": "0.4.3",
"gulp-sourcemaps": "1.6.0",
"gulp-uglify": "1.5.4",
"gulp-useref": "3.1.0",
"jasmine-core": "2.4.1",
"karma": "1.1.2",
"karma-chrome-launcher": "1.0.1",
"karma-coverage": "1.1.1",
"karma-jasmine": "1.0.2",
"karma-junit-reporter": "1.1.0",
"karma-phantomjs-launcher": "1.0.1",
"karma-script-launcher": "1.0.0",
"lazypipe": "1.0.1",
"lodash": "4.14.0",
"main-bower-files": "2.13.1",
"map-stream": "0.0.6",
"phantomjs-prebuilt": "2.1.9",
"proxy-middleware": "0.15.0",
"run-sequence": "1.2.2",
"xml2js": "0.4.16",
"yargs": "4.8.1",
"useref": "1.4.1",
"esquery": "1.0.1"
},
"engines": {
"node": "^4.3"
},
"scripts": {
"test": "gulp test"
}
}
npm-debug
warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules/chokidar/node_modules/fsevents):
150443 warn notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
150444 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid OS: darwin
150444 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Valid Arch: any
150444 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual OS: linux
150444 verbose notsup SKIPPING OPTIONAL DEPENDENCY: Actual Arch: x64
150445 warn node-fetch#2.6.7 requires a peer of encoding#^0.1.0 but none was installed.
150446 verbose If you need help, you may report this error at:
150446 verbose <https://github.com/npm/npm/issues>
150447 verbose stack Error: ENOTDIR: not a directory, open '/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq/node_modules/.staging/#types/node-69b48d6f/package.json'
150447 verbose stack at Error (native)
150448 verbose cwd /home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq
150449 error Linux 4.19.0-13-amd64
150450 error argv "/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq/node/node" "/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq/node/node_modules/npm/bin/npm-cli.js" "install"
150451 error node v4.4.3
150452 error npm v3.10.10
150453 error path /home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq/node_modules/.staging/#types/node-69b48d6f/package.json
150454 error code ENOTDIR
150455 error errno -20
150456 error syscall open
150457 error ENOTDIR: not a directory, open '/home/pparker/workspaces/eclipse/abc/abc_refactor/abc_qqqq/abc-batch-qqqq/node_modules/.staging/#types/node-69b48d6f/package.json'
150458 error If you need help, you may report this error at:
150458 error <https://github.com/npm/npm/issues>
150459 verbose exit [ -20, true ]
I cannot upgrade to newer npm versions, because of the angularjs app and dependencies. I tried to move to npm6, but the application also packaging stopped working
Anyone have any clues about this? I'm completely desperated...
Thanks in advance and sorry again.
I found the problem!
It is related with the library generator-jhipster (or any of its dependencies)
We don't use it anymore, so i got rid of it and everything works again!
Thanks everybody!
Just solved the issue. It's because there's a file called tmp in the home directory.
rm -rf ~/tmp
sudo npm cache clear
sudo npm install -g node
Also... if you are trying to install npm then the same error and solution applies - delete ~/tmp
This issue might be related to a library with an incorrect/incompatible version on your package.json file. I've had the same issue in the past, and in my case, it was caused by browser-sync.
To check if this is your case, you can change your package.json file, removing the libraries line by line (or, "grouping" them and removing group by group), and run the install command to see if the installation works properly.
The expected results are that after removing the problematic library, the install command should work.
After identifying it, you can try downgrading it to a version that worked with your project before.

How do I solve npm install issue after deleting node_modules

I am trying to clean out my react-native project's package to do a clean npm install on a MacOS based system (my windows system for Android development has no issues in cleaning up package versions).
I started seeing errors in the npm instals complaining version differences betwces are not compatible and list differences between versions of each package in "rook project" and node_modules/ directory.
I do the usual fix by removing package-lock.json, delete the node_modules directory and re-run npm install. from my project folder. It immediately made the same error complaints. The problem is this, there is no node_modules in my project folder as I deleted it. And it did not create a new node_modules directory.
Given this issue, how do I debug this and fix it? Questions I'd like to find out:
how do I tell npm to tell me what it thinks root project value is (full path)?
How to tell npm to tell me where the full path to the node_modules directory it seems to see?
Finally, how do I force npm to do the right thing and focus my my project's collaterals and not look outside the project folder as it appears to be doing?
Some of my thoughts. I don't understand why it is making a package cersion comparison between root project and node_modules?
Seems that nodde and npm are doing different things in MacOS environment than in my windows system environment -- I don't understand this.
Anyone here can help me understand what is going on and how to solve it?
The Error output here:
thomas#Presonus americanaradio % npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: AmericanaRadio#0.0.2
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#"^16.8" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" from the
root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.2" from react-native#0.66.4
npm ERR! node_modules/react-native
npm ERR! react-native#"^0.66.3" from the root project
npm ERR! peer react-native#">=0.59" from
#react-native-community/async-storage#1.12.1
npm ERR! node_modules/#react-native-community/async-storage
npm ERR! #react-native-community/async-storage#"^1.12.1" 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/thomas/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/thomas/.npm/_logs/2021-12-10T15_47_02_669Z-debug.log
thomas#Presonus americanaradio %
The package.json content here:
{END)
"name": "AmericanaRadio",
"version": "0.0.2",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/async-storage": "^1.12.1",
"#react-native-community/checkbox": "^0.5.2",
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/slider": "^3.0.3",
"node-fetch": "^2.6.1",
"react": "^16.13.1",
"react-native": "^0.66.3",
"react-native-background-timer": "^2.4.1",
"react-native-elements": "^3.4.2",
"react-native-gesture-handler": "^1.9.0",
"react-native-keyboard-aware-scroll-view": "^0.9.5",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.15.2",
"react-native-simple-survey": "^3.1.2",
"react-native-swift": "^1.2.1",
"react-native-vector-icons": "^8.0.0",
"react-native-version-check": "^3.4.2",
"react-native-version-info": "^1.1.0",
"react-native-webview": "^11.3.1",
"react-navigation": "^4.4.3",
"react-navigation-drawer": "^2.6.0",
"react-navigation-stack": "^2.10.2",
"react-usestateref": "^1.0.8",
"socket.io-client": "^4.4.0"
},
"devDependencies": {
"#babel/core": "^7.12.10",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.18.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
}
}
~
(END)
As noted in my description, the node_modules directory was deleted and running npm install failed and did not create a nodes_modules directory. So the error messages are confusing as I have no packages in my project directory (americanaradio).
Thank you for taking a look at this and hopefully a solution can come out of ths.
First check what library is giving you an error and try to reinstall or update that version . Try deleting node modules also . Then do npm install.

npm: When to use `--force` and `--legacy-peer-deps`

I'm trying to understand how recreating the node_modules directory for deployment works.
We're using npm ci instead of npm install to ensure a clean slate during deployment. However, when we run it without any flags, we get the following error:
Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.
The documentation for npm install for --force is as follows (there are no flags on npm ci's page):
The -f or --force argument will force npm to fetch remote resources even if a local copy exists on disk.
Meanwhile, the documentation for --legacy-peer-deps says:
--legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.
It seems that both flags will let npm ci generate the node_modules directory without any issues, but I am still unclear about the differences between the two.
From what I understand, --force sounds like it will be on a last-dependency-downloaded-wins basis and will overwrite any previously downloaded dependencies. Meanwhile, --legacy-peer-deps sounds like it will always skip peer dependencies (whatever those are) during installation even if there are no issues.
What are the differences between the two flags, and when should we use them?
In the new version of npm (v7), by default, npm install will fail when it encounters conflicting peerDependencies. It was not like that before.
Take a look here for more info about peer dependencies in npm v7.
The differences between the two are below -
--legacy-peer-deps: ignore all peerDependencies when installing, in the style of npm version 4 through version 6.
--strict-peer-deps: fail and abort the install process for any conflicting peerDependencies when encountered. By default, npm will only crash for peerDependencies conflicts caused by the direct dependencies of the root project.
--force: will force npm to fetch remote resources even if a local copy exists on disk.
In the article npm 7 is now generally available!,
You have the option to retry with --force to bypass the conflict or
--legacy-peer-deps command to ignore peer dependencies entirely
(this behavior is similar to versions 4-6).
I agree this sentence is not really clear, but "ignore peer dependencies entirely" does not sound good. Let's use a real example:
Here is a peer dependency error I met when I npm install:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: mobile#undefined
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR! peer react#">=16.0.0" from #testing-library/react-native#7.2.0
npm ERR! node_modules/#testing-library/react-native
npm ERR! dev #testing-library/react-native#"7.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.13.1" from react-native#0.63.2
npm ERR! node_modules/react-native
npm ERR! react-native#"https://github.com/expo/react-native/archive/sdk-39.0.4.tar.gz" from the root project
npm ERR! peer react-native#">=0.59" from #testing-library/react-native#7.2.0
npm ERR! node_modules/#testing-library/react-native
npm ERR! dev #testing-library/react-native#"7.2.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/me/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2021-03-13T00_10_33_813Z-debug.log
npm ERR! code 1
npm ERR! path /Users/me/my-app
npm ERR! command failed
npm ERR! command sh -c sh ./bin/setup.sh
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2021-03-13T00_10_33_860Z-debug.log
Below is the package-lock.json difference between --legacy-peer-deps and --force.
If I run npm install --legacy-peer-deps, it adds this in my package-lock.json:
"node_modules/#unimodules/react-native-adapter": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/#unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz",
"integrity": "sha512-L557/+sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT+kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==",
"dependencies": {
"invariant": "^2.2.4",
"lodash": "^4.5.0"
},
"peerDependencies": {
"react-native": "*",
"react-native-web": "~0.13.7"
}
},
...
"#unimodules/react-native-adapter": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/#unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz",
"integrity": "sha512-L557/+sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT+kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==",
"requires": {
"invariant": "^2.2.4",
"lodash": "^4.5.0"
}
},
If I use npm install --force, instead, it adds
"node_modules/expo/node_modules/#unimodules/react-native-adapter": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/#unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz",
"integrity": "sha512-L557/+sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT+kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==",
"dependencies": {
"invariant": "^2.2.4",
"lodash": "^4.5.0"
},
"peerDependencies": {
"react-native": "*",
"react-native-web": "~0.13.7"
}
},
"node_modules/expo/node_modules/inline-style-prefixer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-5.1.2.tgz",
"integrity": "sha512-PYUF+94gDfhy+LsQxM0g3d6Hge4l1pAqOSOiZuHWzMvQEGsbRQ/ck2WioLqrY2ZkHyPgVUXxn+hrkF7D6QUGbA==",
"peer": true,
"dependencies": {
"css-in-js-utils": "^2.0.0"
}
},
"node_modules/expo/node_modules/react-native-web": {
"version": "0.13.18",
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.13.18.tgz",
"integrity": "sha512-WR/0ECAmwLQ2+2cL2Ur+0/swXFAtcSM0URoADJmG6D4MnY+wGc91JO8LoOTlgY0USBOY+qG/beRrjFa+RAuOiA==",
"peer": true,
"dependencies": {
"array-find-index": "^1.0.2",
"create-react-class": "^15.6.2",
"deep-assign": "^3.0.0",
"fbjs": "^1.0.0",
"hyphenate-style-name": "^1.0.3",
"inline-style-prefixer": "^5.1.0",
"normalize-css-color": "^1.0.2",
"prop-types": "^15.6.0",
"react-timer-mixin": "^0.13.4"
},
"peerDependencies": {
"react": ">=16.5.1",
"react-dom": ">=16.5.1"
}
},
...
"dependencies": {
"#unimodules/react-native-adapter": {
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/#unimodules/react-native-adapter/-/react-native-adapter-5.7.0.tgz",
"integrity": "sha512-L557/+sc8ZKJVgo1734HF1QNCxrt/fpqdmdNgySJT+kErux/AJNfPq3flsK0fyJduVmniTutYIMyW48cFoPKDA==",
"requires": {
"invariant": "^2.2.4",
"lodash": "^4.5.0"
}
},
"inline-style-prefixer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/inline-style-prefixer/-/inline-style-prefixer-5.1.2.tgz",
"integrity": "sha512-PYUF+94gDfhy+LsQxM0g3d6Hge4l1pAqOSOiZuHWzMvQEGsbRQ/ck2WioLqrY2ZkHyPgVUXxn+hrkF7D6QUGbA==",
"peer": true,
"requires": {
"css-in-js-utils": "^2.0.0"
}
},
"react-native-web": {
"version": "0.13.18",
"resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.13.18.tgz",
"integrity": "sha512-WR/0ECAmwLQ2+2cL2Ur+0/swXFAtcSM0URoADJmG6D4MnY+wGc91JO8LoOTlgY0USBOY+qG/beRrjFa+RAuOiA==",
"peer": true,
"requires": {
"array-find-index": "^1.0.2",
"create-react-class": "^15.6.2",
"deep-assign": "^3.0.0",
"fbjs": "^1.0.0",
"hyphenate-style-name": "^1.0.3",
"inline-style-prefixer": "^5.1.0",
"normalize-css-color": "^1.0.2",
"prop-types": "^15.6.0",
"react-timer-mixin": "^0.13.4"
}
}
}
},
As you see, npm install --force still pins many dependency versions which is stricter.
For those wondering which is safer, the answer is --force
--legacy-peer-deps ignores peer dependencies entirely, which can screw up your dependency resolution.
--force on the other hand simply sets a different peer dependency version for conflicting dependencies
Using force isn't always ideal though because each dependency version takes up extra space. Using force with many dependencies will increase your total space requirement a decent amount.

Can't install bcrypt on server for Vuejs 2.6.9/Webpack 4.29.6 project using NodeJS 10.15.3 and NPM 6.4.1 on a Vagrant virtual machine

I have been struggling to install bcrypt all weekend. Over the course of the weekend I have updated Node to version 10.15.3 (and npm 6.4.1).
A possible solution is to forget about bcrypt and install bcryptjs. My (perhaps unfounded?) concern is that the latest version (2.4.3) of bcryptjs is 2 years old whereas bcrypt has the benefit of continuous support. I would like to use bcrypt in my project.
Here is the error I got:
vagrant [server]> npm install bcrypt
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! path /vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.3160920247
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/yallist/package.json.3160920247'
On the server folder...
package.json
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "./node_modules/nodemon/bin/nodemon.js src/app.js --exec 'npm run lint && node'",
"lint": "./node_modules/.bin/eslint \"**/*.js\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"dotenv": "^7.0.0",
"express": "^4.16.4",
"joi": "^14.3.1",
"jsonwebtoken": "^8.5.0",
"morgan": "^1.9.1",
"pg": "^7.9.0",
"pg-hstore": "^2.3.2",
"semver": "^5.6.0",
"sequelize": "^5.1.0"
},
"devDependencies": {
"eslint": "^5.15.3",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-plugin-import": "^2.16.0",
"eslint-plugin-vue": "^5.2.2",
"nodemon": "^1.18.10"
}
}
npm list -g --depth=0 returns:
/home/vagrant/.nvm/versions/node/v10.15.3/lib
├── #vue/cli#3.5.0
├── #vue/cli-init#3.5.0
├── http-server#0.11.1
├── node-gyp#3.8.0
├── npm#6.4.1
├── npm-check#5.9.0
└── npx#10.2.0
cat /etc/*release returns:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial
OS of my mac: 10.13.6
MAJOR EDIT 1:
I did the following:
vagrant [server]> sudo apt install node-gyp
And then I got this error:
vagrant [server]> npm install bcrypt
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! path /vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/safe-buffer/package.json.3118274111
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/vagrant/barbershop-pevn/server/node_modules/bcrypt/node_modules/minipass/node_modules/safe-buffer/package.json.3118274111'
What am I missing? Any help that allows for the installation of bcrypt or at least points me in the right direction is greatly appreciated.
I think this is an npm issue. I can successfully install bcrypt using yarn or pnpm (which looks rather attractive) on NodeJS versions 8.15.1 and 10.15.3. My question was about installing bcrypt (not necessarily using npm) so I'm going to say I got a satisfactory answer for the time being: Use yarn or pnpm (or just install brcyptjs). I have raised an issue on github.

Resources