I am having issues deploying my node app to Heroku. I am getting the following error in the logs:
Installing dependencies
Installing node modules
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: undefined
npm ERR! notsup Actual OS: linux
npm ERR! notsup Actual Arch: x64
I already deleted the node_modules folder and did npm install. I checked the package-lock-json file for the version. Example.
"node_modules/#next/swc-darwin-x64": {
"version": "11.1.4",
"resolved": "https://registry.npmjs.org/#next/swc-darwin-x64/-/swc-darwin-x64-11.1.4.tgz",
"integrity": "sha512-5i9tOQNO8kawwggHvQUVR3a5KzIGaE2dw1g1kL//z/N840djvGseHrJSFEGdP1c35gM+dSGPpAKHmeBKrwHM8g==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
There are some specified with darwin but not sure what I would need to add here. Any help would be greatly appreciated. Thanks!
Related
I was learning vuepress and tried make a small blog site and decided to deploy it on netlify and it gave me this error. After some googling I found that removing package-lock.json would help but I am facing the same error after deleting package-lock.json
5:57:41 PM: npm ERR! code EBADPLATFORM
5:57:41 PM: npm ERR! notsup Unsupported platform for esbuild-windows-64#0.14.36: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
5:57:41 PM: npm ERR! notsup Valid OS: win32
5:57:41 PM: npm ERR! notsup Valid Arch: x64
5:57:41 PM: Creating deploy upload records
5:57:41 PM: npm ERR! notsup Actual OS: linux
I am using Vite as package manager.It is running fine in local server.
TL;DR;
Try running npm update to update the esbuild package dependencies in your package-lock.json file.
Background
First, you should not remove your package-lock.json file. It is an important file with a purpose and should remain version controlled (https://nodejs.dev/learn/the-package-lock-json-file).
I believe the issue is that vite uses esbuild. esbuild lists a number of optionalDependencies:
"optionalDependencies": {
"esbuild-android-64": "0.14.32",
"esbuild-android-arm64": "0.14.32",
"esbuild-darwin-64": "0.14.32",
"esbuild-darwin-arm64": "0.14.32",
"esbuild-freebsd-64": "0.14.32",
// and so on...
}
Each of these dependencies lists a CPU and OS it depends on, like in your error:
"node_modules/esbuild-windows-64": {
"version": "0.14.32",
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.14.32.tgz",
"integrity": "sha512-+p4MuRZekVChAeueT1Y9LGkxrT5x7YYJxYE8ZOTcEfeUUN43vktSn6hUNsvxzzATrSgq5QqRdllkVBxWZg7KqQ==",
"cpu": [
"x64"
],
"dev": true,
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=12"
}
}
For some reason, up to a certain version of esbuild these dependencies cause Netlify to think these platforms are required and thus it fails because its container is running Linux. Updating to at least version 0.14.36 fixed the problem for me, there's an ever newer version out than that at the time of this writing. You will still see warnings such as
2:59:00 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: esbuild-windows-64#0.14.49 (node_modules/esbuild-windows-64):
2:59:00 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for esbuild-windows-64#0.14.49: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
but the build will no longer fail.
I wrote a web app back in November 2020, and it was working perfectly fine then.
But now when I download it, and try to install it via 'npm install' I get a ton of errors.
The project is located here if anyone wants to try it:
https://github.com/pintof/Web-App---Contact-Cards
Or can just try running 'npm install' on a package.json file filled with the following contents:
{
"name": "a3",
"version": "1.0.1",
"description": "CIS2750 F20 - A3",
"main": "app.js",
"scripts": {
"dev": "nodemon app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.17.1",
"express-fileupload": "^1.2.0",
"ffi-napi": "^3.0.1",
"http": "0.0.1-security",
"javascript-obfuscator": "^2.6.1",
"mysql2": "^2.0.0",
"nodemon": "^2.0.5"
}
}
I hypothesize that the errors are due to a package/dependency problem.
By the look of the errors it appears to be with the package 'ffi-napi' or the dependency 'node-gyp'.
I have tried removing the '^' from the package versions, and tried using an older version of 'node-gyp' version 7.1.2 to be precise as some people noted bugs with newer versions after this one, my package.json then looked like this:
{
"name": "a3",
"version": "1.0.1",
"description": "CIS2750 F20 - A3",
"main": "app.js",
"scripts": {
"dev": "nodemon app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"express": "4.17.1",
"express-fileupload": "1.2.0",
"ffi-napi": "3.0.1",
"http": "0.0.1-security",
"javascript-obfuscator": "2.6.1",
"mysql2": "2.0.0",
"nodemon": "2.0.5"
},
"devDependencies": {
"node-gyp": "7.1.2"
}
}
But I still got the same errors. I get these errors on both linux & windows. Have tried the newest version of node.js & npm, and multiple older versions like version 12 of node.js, version 8 of node.js, and I can't even remember all the many versions of npm I tried, but I'm quite sure by now that changing the node.js version or npm version will not fix the problem, and it lies more with the packages/dependencies.
I've also tried running the newest version of 'ffi-napi' & 'node-gyp', but get the exact same errors.
Here is a screenshot of my errors:
errors screenshot
Here is my log file:
https://pintof.github.io/2022-02-28T07_08_19_080Z-debug.log
And here are the errors in plain text:
> ref-napi#2.1.2 install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi
> node-gyp-build
> ffi-napi#3.1.0 install /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
> node-gyp-build
make: Entering directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
AR(target) Release/obj.target/../node-addon-api/src/nothing.a
COPY Release/nothing.a
CC(target) Release/obj.target/ffi/deps/libffi/src/prep_cif.o
CC(target) Release/obj.target/ffi/deps/libffi/src/types.o
CC(target) Release/obj.target/ffi/deps/libffi/src/raw_api.o
CC(target) Release/obj.target/ffi/deps/libffi/src/java_raw_api.o
CC(target) Release/obj.target/ffi/deps/libffi/src/closures.o
../deps/libffi/src/closures.c: In function ‘dlmmap_locked’:
../deps/libffi/src/closures.c:421:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
421 | ftruncate (execfd, offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../deps/libffi/src/closures.c:433:7: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result [-Wunused-result]
433 | ftruncate (execfd, offset);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi.o
CC(target) Release/obj.target/ffi/deps/libffi/src/x86/ffi64.o
../deps/libffi/src/x86/ffi64.c: In function ‘classify_argument’:
../deps/libffi/src/x86/ffi64.c:181:18: warning: suggest braces around empty body in an ‘else’ statement [-Wempty-body]
181 | FFI_ASSERT (0);
| ^
../deps/libffi/src/x86/ffi64.c:156:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
156 | {
| ^
../deps/libffi/src/x86/ffi64.c:183:5: note: here
183 | case FFI_TYPE_FLOAT:
| ^~~~
CC(target) Release/obj.target/ffi/deps/libffi/src/x86/unix64.o
CC(target) Release/obj.target/ffi/deps/libffi/src/x86/sysv.o
AR(target) Release/obj.target/deps/libffi/libffi.a
COPY Release/libffi.a
CXX(target) Release/obj.target/ffi_bindings/src/ffi.o
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/node-addon-api: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-uv-event-loop-napi-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/get-symbol-from-current-process-h/include: No such file or directory
g++: error: Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ref-napi/include: No such file or directory
make: *** [ffi_bindings.target.mk:116: Release/obj.target/ffi_bindings/src/ffi.o] Error 1
make: Leaving directory '/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:198:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 4.4.0-19041-Microsoft
gyp ERR! command "/usr/bin/node" "/mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/Users/Fraeya Pinto/Desktop/Web-App---Contact-Cards-main/include/node_modules/ffi-napi
gyp ERR! node -v v10.19.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
npm WARN notsup Unsupported engine for express-fileupload#1.3.1: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: express-fileupload#1.3.1
npm WARN notsup Unsupported engine for javascript-obfuscator#2.19.1: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: javascript-obfuscator#2.19.1
npm WARN notsup Unsupported engine for eslint-scope#6.0.0: wanted: {"node":"^12.22.0 || ^14.17.0 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: eslint-scope#6.0.0
npm WARN notsup Unsupported engine for commander#8.2.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander#8.2.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.3.2 (node_modules/chokidar/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 a3#1.0.1 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ffi-napi#3.1.0 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ffi-napi#3.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/floyd/.npm/_logs/2022-02-28T07_08_19_080Z-debug.log
Any solutions would be greatly appreciated!
I am installing nest.js on CentOS 7. I get this error:
file:///usr/lib/node_modules/#nestjs/cli/node_modules/#nuxtjs/opencollective/src/index.js:7
;(async () => {
^
SyntaxError: Unexpected token (
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.2 (node_modules/#nestjs/cli/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-693.21.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/bin/npm" "i" "-g" "#nestjs/cli"
npm ERR! node v6.14.3
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! #nestjs/cli#5.5.0 postinstall: `opencollective`
npm ERR! Exit status 1
Any idea?
The answer lies right in the error message:
npm ERR! node v6.14.3
Not sure which version of nest.js you are trying to install, but the current version has this requirement:
"engines": {
"node": ">= 8.9.0"
},
See official nest.js packages.json.
This works on my centos 7. The command that I used are
[root#yellowdog ~]# npm install -g #nestjs/cli
/usr/bin/nest -> /usr/lib/node_modules/#nestjs/cli/bin/nest.js
> #nestjs/cli#5.5.0 postinstall /usr/lib/node_modules/#nestjs/cli
> opencollective
Thanks for installing nest 🙏
Please consider donating to our open collective
to help us maintain this package.
Number of contributors: 54
Number of backers: 97
Annual budget: US$ 37,495
Current balance: US$ 246
👉 Become a partner: https://opencollective.com/nest/donate
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/#nestjs/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ #nestjs/cli#5.5.0
added 215 packages from 173 contributors in 20.529s
[root#yellowdog ~]# node -v
v8.11.4
[root#yellowdog ~]# npm -v
6.4.1
[root#yellowdog ~]# nest --version
5.5.0
I'm trying to use node for the first time in a VS project in windows. I installed node.js, below is the info:
node -v
v8.9.3
npm -v
5.5.1
Completed setup in the project using npm init, that seemed to work fine.
npm install lite-server --save-dev produced the following error:
$ npm install lite-server --save-dev
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS: darwin
npm ERR! notsup Valid Arch: any
npm ERR! notsup Actual OS: win32
npm ERR! notsup Actual Arch: x64
I don't understand the errors. Help. Thanks!
The error comes from fsevents#1.1.3, which is a dependency package of lite-server.
fsevents#1.1.3 only works in macOS. See its npm info page.
Native access to OS X FSEvents in Node.js
The FSEvents API in OS X allows applications to register for
notifications of changes to a given directory tree. It is a very fast
and lightweight alternative to kqueue.
Similar issues also apply to other npm packages with such dependency.
I am using npm#5.6.0, the latest stable release, and tried install on my Windows. The error turns out to a warning and let lite-server installed eventually. Anyway, fsevents is just an optional dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\lite-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ lite-server#2.3.0
added 279 packages in 81.466s
I found the fix for Ubuntu 18.04/20.04 after working for whole day. This should work for other Linux distros
Run following command for globally using lite-server
sudo npm install lite-server -g
Your package.json file should contain
"devDependencies": {
"lite-server": "^2.5.4"
}
and scipt should look like
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server"
},
For development mode run following
sudo npm i lite-server --save-dev
Local server could started using npm command
npm start
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"
}
}