Apologies in advance as I'm sure these are rather trivial matters - I am in the "hello world" phase of learning front-end development.
I have a hello-world vite app, which I created and ran simply via:
npm init #vitejs/app
cd hello-vite
npm install npm run dev
I'm able to view the outputted localhost url in my browser.
I also have a simple script that imports tensorflow and does something with it:
$ cat test.mjs
import * as tf from '#tensorflow/tfjs-node'
const a = tf.tensor([[1, 2], [3, 4]]);
a.print();
$ node test.mjs
2022-06-27 22:04:16.968270: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Tensor
[[1, 2],
[3, 4]]
Now I want to get this test.mjs behavior within my hello-vite app. So I tried something like:
$ cat main.ts
import './style.css'
import * as tf from '#tensorflow/tfjs-node'
const a = tf.tensor([[1, 2], [3, 4]]);
a.print();
document.querySelector('#app').innerHTML = `
<h1>Hello Vite!!!</h1>
Documentation
`
But when I run npm run dev, it doesn't seem happy, and spouts seemingly unrelated complaints about aws stuff:
$ npm run dev
> hello-vite#0.0.0 dev
> vite
vite v2.9.12 dev server running at:
> Local: http://localhost:3000/
> Network: use `--host` to expose
ready in 112ms.
✘ [ERROR] Could not resolve "mock-aws-s3"
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
43 │ const AWSMock = require('mock-aws-s3');
╵ ~~~~~~~~~~~~~
You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
✘ [ERROR] Could not resolve "aws-sdk"
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22:
76 │ const AWS = require('aws-sdk');
╵ ~~~~~~~~~
You can mark the path "aws-sdk" as external to exclude it from the bundle, which will remove this
error. You can also surround this "require" call with a try/catch block to handle this failure at
run-time instead of bundle-time.
✘ [ERROR] Could not resolve "nock"
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23:
112 │ const nock = require('nock');
╵ ~~~~~~
You can mark the path "nock" as external to exclude it from the bundle, which will remove this
error. You can also surround this "require" call with a try/catch block to handle this failure at
run-time instead of bundle-time.
10:06:42 PM [vite] error while updating dependencies:
Error: Build failed with 3 errors:
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28: ERROR: Could not resolve "mock-aws-s3"
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:76:22: ERROR: Could not resolve "aws-sdk"
node_modules/#mapbox/node-pre-gyp/lib/util/s3_setup.js:112:23: ERROR: Could not resolve "nock"
at failureErrorWithLog (/home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:1605:15)
at /home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:1251:28
at runOnEndCallbacks (/home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:1034:63)
at buildResponseToResult (/home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:1249:7)
at /home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:1358:14
at /home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:666:9
at handleIncomingPacket (/home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:763:9)
at Socket.readFromStdout (/home/dshin/vite_scratch/hello-vite/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
Vite Error, /node_modules/.vite/deps/#tensorflow_tfjs-node.js?v=0ea0383e optimized info should be defined
If I comment out the print() call and the line before it, the errors disappear.
What am I doing wrong? How do I make sense of these errors?
I don't know too much, but #tensorflow/tfjs-node appears to just be a Node project, and won't work in the browser.
For example, node-pre-gyp is a C++ binding library for Node, that is definitely not going to work in the browser.
You can try doing npm install mock-aws-s3 and the other libraries that errored, see how far that gets you, but likely won't help.
Related
I am building an app with SvelteKit and publishing it to Cloudflare Pages, but it is some packages I am using are not able to access node native functions. Here's the build log:
2022-07-30T19:05:14.200499Z > Using #sveltejs/adapter-cloudflare
2022-07-30T19:05:14.227308Z ✘ [ERROR] Could not resolve "url"
2022-07-30T19:05:14.227701Z
2022-07-30T19:05:14.227859Z node_modules/sequelize/lib/sequelize.js:21:20:
2022-07-30T19:05:14.228009Z 21 │ const url = require("url");
2022-07-30T19:05:14.22817Z ╵ ~~~~~
2022-07-30T19:05:14.228388Z
2022-07-30T19:05:14.228525Z The package "url" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.228694Z
2022-07-30T19:05:14.22885Z ✘ [ERROR] Could not resolve "path"
2022-07-30T19:05:14.229004Z
2022-07-30T19:05:14.229168Z node_modules/sequelize/lib/sequelize.js:22:21:
2022-07-30T19:05:14.22932Z 22 │ const path = require("path");
2022-07-30T19:05:14.229452Z ╵ ~~~~~~
2022-07-30T19:05:14.229593Z
2022-07-30T19:05:14.229733Z The package "path" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.229891Z
2022-07-30T19:05:14.241501Z ✘ [ERROR] Could not resolve "#firebase/database-compat/standalone"
2022-07-30T19:05:14.2417Z
2022-07-30T19:05:14.241833Z node_modules/firebase-admin/lib/app/firebase-namespace.js:106:41:
2022-07-30T19:05:14.242066Z 106 │ ...ject.assign(fn, require('#firebase/database-compat/standalone'));
2022-07-30T19:05:14.242206Z ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022-07-30T19:05:14.242323Z
2022-07-30T19:05:14.242435Z The path "./standalone" is not currently exported by package "#firebase/database-compat":
2022-07-30T19:05:14.242596Z
2022-07-30T19:05:14.243619Z node_modules/#firebase/database-compat/package.json:16:13:
2022-07-30T19:05:14.244219Z 16 │ "exports": {
2022-07-30T19:05:14.244437Z ╵ ^
2022-07-30T19:05:14.244574Z
2022-07-30T19:05:14.244698Z None of the conditions provided ("types", "node") match any of the currently active conditions ("browser", "default", "require"):
2022-07-30T19:05:14.24483Z
2022-07-30T19:05:14.244956Z node_modules/#firebase/database-compat/package.json:27:20:
2022-07-30T19:05:14.24507Z 27 │ "./standalone": {
2022-07-30T19:05:14.245196Z ╵ ^
2022-07-30T19:05:14.245368Z
2022-07-30T19:05:14.2455Z Consider enabling the "types" condition if this package expects it to be enabled. You can use "conditions: ['types']" to do that:
2022-07-30T19:05:14.245626Z
2022-07-30T19:05:14.245736Z node_modules/#firebase/database-compat/package.json:28:6:
2022-07-30T19:05:14.245847Z 28 │ "types": "./dist/database-compat/src/index.standalone.d.ts",
2022-07-30T19:05:14.245969Z ╵ ~~~~~~~
2022-07-30T19:05:14.24608Z
2022-07-30T19:05:14.246397Z You can mark the path "#firebase/database-compat/standalone" as external to exclude it from the bundle, which will remove this error. You can also surround this "require" call with a try/catch block to handle this failure at run-time instead of bundle-time.
2022-07-30T19:05:14.246547Z
2022-07-30T19:05:14.282052Z ✘ [ERROR] Could not resolve "util"
2022-07-30T19:05:14.282324Z
2022-07-30T19:05:14.282497Z node_modules/retry-as-promised/index.js:3:19:
2022-07-30T19:05:14.282669Z 3 │ var util = require('util');
2022-07-30T19:05:14.282834Z ╵ ~~~~~~
2022-07-30T19:05:14.282992Z
2022-07-30T19:05:14.28312Z The package "util" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.283505Z
2022-07-30T19:05:14.317451Z ✘ [ERROR] Could not resolve "url"
2022-07-30T19:05:14.317714Z
2022-07-30T19:05:14.317856Z node_modules/pg-connection-string/index.js:3:18:
2022-07-30T19:05:14.317986Z 3 │ var url = require('url')
2022-07-30T19:05:14.318109Z ╵ ~~~~~
2022-07-30T19:05:14.318238Z
2022-07-30T19:05:14.318505Z The package "url" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.318665Z
2022-07-30T19:05:14.319392Z ✘ [ERROR] Could not resolve "util"
2022-07-30T19:05:14.319808Z
2022-07-30T19:05:14.319968Z node_modules/sequelize/lib/utils/deprecations.js:32:37:
2022-07-30T19:05:14.320241Z 32 │ var import_util = __toModule(require("util"));
2022-07-30T19:05:14.320559Z ╵ ~~~~~~
2022-07-30T19:05:14.320699Z
2022-07-30T19:05:14.320823Z The package "util" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.321042Z
2022-07-30T19:05:14.326057Z ✘ [ERROR] Could not resolve "fs"
2022-07-30T19:05:14.327248Z
2022-07-30T19:05:14.328892Z node_modules/sequelize/lib/dialects/sqlite/connection-manager.js:2:19:
2022-07-30T19:05:14.329459Z 2 │ const fs = require("fs");
2022-07-30T19:05:14.329823Z ╵ ~~~~
2022-07-30T19:05:14.33005Z
2022-07-30T19:05:14.330876Z The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.331054Z
2022-07-30T19:05:14.331281Z ✘ [ERROR] Could not resolve "assert"
2022-07-30T19:05:14.331476Z
2022-07-30T19:05:14.331604Z node_modules/sequelize/lib/model.js:21:23:
2022-07-30T19:05:14.33172Z 21 │ const assert = require("assert");
2022-07-30T19:05:14.331829Z ╵ ~~~~~~~~
2022-07-30T19:05:14.331936Z
2022-07-30T19:05:14.33237Z The package "assert" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.332543Z
2022-07-30T19:05:14.332673Z ✘ [ERROR] Could not resolve "util"
2022-07-30T19:05:14.332789Z
2022-07-30T19:05:14.333338Z node_modules/sequelize/lib/data-types.js:2:21:
2022-07-30T19:05:14.334026Z 2 │ const util = require("util");
2022-07-30T19:05:14.334206Z ╵ ~~~~~~
2022-07-30T19:05:14.33441Z
2022-07-30T19:05:14.334627Z The package "util" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.334959Z
2022-07-30T19:05:14.335106Z ✘ [ERROR] Could not resolve "fs"
2022-07-30T19:05:14.335239Z
2022-07-30T19:05:14.33556Z node_modules/pg-connection-string/index.js:4:17:
2022-07-30T19:05:14.335971Z 4 │ var fs = require('fs')
2022-07-30T19:05:14.336165Z ╵ ~~~~
2022-07-30T19:05:14.336703Z
2022-07-30T19:05:14.337207Z The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.337373Z
2022-07-30T19:05:14.337521Z ✘ [ERROR] Could not resolve "fs"
2022-07-30T19:05:14.337657Z
2022-07-30T19:05:14.337784Z node_modules/firebase-admin/lib/app/lifecycle.js:21:19:
2022-07-30T19:05:14.337911Z 21 │ const fs = require("fs");
2022-07-30T19:05:14.338056Z ╵ ~~~~
2022-07-30T19:05:14.338211Z
2022-07-30T19:05:14.338342Z The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
2022-07-30T19:05:14.338478Z
2022-07-30T19:05:14.33862Z ✘ [ERROR] Could not resolve "util"
2022-07-30T19:05:14.338756Z
2022-07-30T19:05:14.339295Z node_modules/sequelize/lib/utils/logger.js:59:37:
2022-07-30T19:05:14.339765Z 59 │ var import_util = __toModule(require("util"));
2022-07-30T19:05:14.339936Z ╵ ~~~~~~
2022-07-30T19:05:14.340093Z
2022-07-30T19:05:14.340237Z The package "util" wasn't found on the file system but is built into node. Are you trying to bundle for node? You can use "platform: 'node'" to do that, which will remove this error.
...............
2022-07-30T19:05:14.89587Z
2022-07-30T19:05:14.896004Z error during build:
2022-07-30T19:05:14.896124Z Error: Build failed with 234 errors:
2022-07-30T19:05:14.896252Z node_modules/#fastify/busboy/deps/dicer/lib/Dicer.js:1:31: ERROR: Could not resolve "stream"
2022-07-30T19:05:14.896371Z node_modules/#fastify/busboy/deps/dicer/lib/Dicer.js:2:25: ERROR: Could not resolve "util"
2022-07-30T19:05:14.896477Z node_modules/#fastify/busboy/deps/dicer/lib/HeaderParser.js:1:29: ERROR: Could not resolve "events"
2022-07-30T19:05:14.896588Z node_modules/#fastify/busboy/deps/dicer/lib/HeaderParser.js:2:25: ERROR: Could not resolve "util"
2022-07-30T19:05:14.896701Z node_modules/#fastify/busboy/deps/dicer/lib/PartStream.js:1:25: ERROR: Could not resolve "util"
2022-07-30T19:05:14.896818Z ...
2022-07-30T19:05:14.896942Z at failureErrorWithLog (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1621:15)
2022-07-30T19:05:14.897064Z at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1263:28
2022-07-30T19:05:14.897441Z at runOnEndCallbacks (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1176:65)
2022-07-30T19:05:14.897756Z at buildResponseToResult (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:1261:7)
2022-07-30T19:05:14.898025Z at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:1374:14
2022-07-30T19:05:14.898328Z at /opt/buildhome/repo/node_modules/esbuild/lib/main.js:675:9
2022-07-30T19:05:14.898627Z at handleIncomingPacket (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:772:9)
2022-07-30T19:05:14.898889Z at Socket.readFromStdout (/opt/buildhome/repo/node_modules/esbuild/lib/main.js:641:7)
2022-07-30T19:05:14.90122Z at Socket.emit (node:events:527:28)
2022-07-30T19:05:14.901427Z at addChunk (node:internal/streams/readable:315:12)
2022-07-30T19:05:14.917314Z Failed: build command exited with code: 1
2022-07-30T19:05:16.243508Z Failed: an internal error occurred
This is happening just after I added some server side code so that might be the reason, but Sveltekit supports that through cloudflare workers so I don't understand why.
I ran into this same issue trying to migrate from Vercel to Cloudflare Pages and it looks like Cloudflare Workers (which is what Pages uses under the hood for functions) only supports Node.js packages that uses webpack or another polyfill bundler since it is not Node.js. It only runs JavaScript code using the V8 engine on the edge network not in a Node.js runtime so any Node.js package that has Node.js specific dependencies like fs and net/http are not compatible.
Here is a list of Cloudflare Workers compatible packages and here is some further reading on how Node.js and Cloudflare Workers work together.
To get your project deployed to Cloudflare Pages you will need to refactor your code to only use Node.js packages from the above list of compatible packages or implement any functionality using plain JavaScript if a compatible package does not exist.
I have been searching about Next.js, the javascript framework of the moment, and I want to begin to practice. The problem is: it doesn't run in my computer by any means.
The natural form on creating a next project is with the command line:
npx create-next-app
or
yarn create next-app
The result is a template project with a file structure and a few scripts to run the server. The most basic script runs the server in development mode:
npm run dev
or
yarn dev
The result in terminal is the warning:
$ yarn dev
yarn run v1.22.5
$ next dev
(node:5348) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution
of the package at C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\node_modules\postcss\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
ready - started server on http://localhost:3000
error - C:/Users/maths/Documents/codigos/node/my-app/pages/_app.js 4:9
Module parse failed: Unexpected token (4:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. S
ee https://webpack.js.org/concepts#loaders
|
| function MyApp({ Component, pageProps }) {
> return <Component {...pageProps} />
| }
|
And when I enter the website in localhost:3000, the page on browser shows:
Internal Server Error
After making the http requisition from the browser, the terminal shows the following message:
event - build page: /next/dist/pages/_error
wait - compiling...
error - C:/Users/maths/Documents/codigos/node/my-app/pages/_app.js 4:9
Module parse failed: Unexpected token (4:9)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. S
ee https://webpack.js.org/concepts#loaders
|
| function MyApp({ Component, pageProps }) {
> return <Component {...pageProps} />
| }
|
Error: Cannot find module 'C:\Users\maths\Meus Documentos\codigos\node\my-app\.next\server\pages-manifest.json'
Require stack:
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\require.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\load-components.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\api-utils.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\next-server.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\server\next.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\server\lib\start-server.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\cli\next-dev.js
- C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\bin\next
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at getPagePath (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\require.js:1:
657)
at requirePage (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\require.js:1:
1062)
at loadComponents (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\load-compo
nents.js:1:807)
at DevServer.findPageComponents (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\ser
ver\next-server.js:74:296)
at DevServer.renderErrorToHTML (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\serv
er\next-server.js:126:120)
at DevServer.renderErrorToHTML (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\server\next-dev-
server.js:34:974)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async DevServer.render (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\ne
xt-server.js:72:236)
at async Object.fn (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\next-serv
er.js:56:618)
at async Router.execute (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\rout
er.js:23:67)
at async DevServer.run (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\server\next-
server.js:66:1042)
at async DevServer.handleRequest (C:\Users\maths\Documents\codigos\node\my-app\node_modules\next\dist\next-server\se
rver\next-server.js:34:1081) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\next-server\\server\\require.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\next-server\\server\\load-components.
js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\next-server\\server\\api-utils.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\next-server\\server\\next-server.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\server\\next.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\server\\lib\\start-server.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\cli\\next-dev.js',
'C:\\Users\\maths\\Documents\\codigos\\node\\my-app\\node_modules\\next\\dist\\bin\\next'
]
}
I have tried several things to fix it, create the next project without the script from npx and yarn (by manually installing the dependencies), update versions of node and npm, etc. It seems that the program can't load the jsx, the first error points to the moment when the first jsx component appear in the code. The message says that webpack isn't configured with a valid loader to this code.
Environment:
Win 10
npm v7.3.0
node v15.5.0
next v10.0.4
react v17.0.1
react-dom v17.0.1
Downgrade your version of Nodejs to 14 or 12 Node version 15 will break your environment. If you want to still want to use 15 get node version switcher and switch the version based on the projects your working on.
I took the project I am developing at my workplace home and wanted to run it here on my machine.
I got many many errors which I fixed, but there are some that I don't know how. Maybe you guys know a fix.
\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
this output get generated when building the project from AS.
I read that the fix is to add this: android.enableBuildCache=false to gradle.properties but when I do that I get this error which make 0 sense tbh.
: Cannot parse project property android.enableBuildCache='false ' of type 'class java.lang.String' as boolean. Expected 'true' or 'false'.
EDIT: Ok there was an empty space after false hence the second error but even with that corrected I get the first error.
Running it from vsCode gives me: Execution failed for task ':app:processDebugResources'.
EDIT2: Newest Error in AS:
> Task :app:mergeExtDexDebug
java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:80)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:522)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at java.nio.file.Files.list(Files.java:3451)
at com.android.build.gradle.internal.tasks.DexMergingParams.getAllDexFiles(DexMergingTask.kt:502)
at com.android.build.gradle.internal.tasks.DexMergingTaskRunnable.run(DexMergingTask.kt:423)
at com.android.build.gradle.internal.tasks.Workers$ActionFacade.run(Workers.kt:335)
at org.gradle.workers.internal.AdapterWorkAction.execute(AdapterWorkAction.java:50)
at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:50)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:65)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1$1.create(NoIsolationWorkerFactory.java:61)
at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:98)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.execute(NoIsolationWorkerFactory.java:61)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:53)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:217)
at org.gradle.workers.internal.DefaultWorkerExecutor$3.call(DefaultWorkerExecutor.java:212)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:215)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:164)
at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:131)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.lang.Thread.run(Thread.java:748)
> Task :app:transformClassesWithDexBuilderForDebug
> Task :app:validateSigningDebug UP-TO-DATE
> Task :app:signingConfigWriterDebug
> Task :app:mergeDebugJavaResource
> Task :app:mergeExtDexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.nio.file.NoSuchFileException: C:\Users\Faded\Desktop\Development\React Native\FitnessApp\FitnessApp\android\app\build\intermediates\external_file_lib_dex_archives\debug\out
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 19s
150 actionable tasks: 147 executed, 3 up-to-date
Try to delete the .gradle folder from projectname/android - folder and rebuild. Solved it for me.
I have encountered a similar error before. As a result of my research as a solution
In the android/app/build.gradle file multiDexEnabled true
android {
defaultConfig {
...
targetSdkVersion 28
multiDexEnabled true // here
}
...
}
As Murat Kızılöz suggested, you can get around this by adding multiDexEnabled truein the android/app/build.gradle file.
This is because Android system has a 64K reference limit
In Android, the compilers convert your source code into DEX files. This DEX file
contains the compiled code used to run the app. But there is a limitation with the
DEX file. The DEX file limits the total number of methods that can be referenced
within a single DEX file to 64K i.e. 65,536 methods. So, you cant use more than
64K methods in a particular DEX file. These 64K methods include Android framework
methods, library methods, and methods in our code also. This limit of 64K is
referred to as the "64K reference limit".
So, if our app exceeds 65,536 methods, we will encounter a build error that indicates our app has reached the limit of the Android build architecture.
To get around this, you can manually enable this in the app build.gradle file
You can read more about this at Android Multidex
Try this command in your project root:
cd android && rm -rf .gradle && rm -rf .idea
and then
./gradlew clean
and then build again, works like a charm.
You can solve this issue by deleting the .gradle folder from "NameOfProject/android" and again running Android-Studio, I hoped this is solved. :))
I'm migrating a coffeescript app into typescript. There is a coffeescript-to-typescript tool that seems to help a lot with the job. Unfortunately, I can't get it working and the errors thrown seem ridiculous...
This is an example coffee file:
CoreModule.service('FileRequire', [
# dependencies
() ->
#resolver = (subdirectory, extension) ->
(pathcode) ->
tmp = pathcode.split ':'
modules = tmp[0]
file = tmp[1]
'app/modules/' + modules.split('/').join('/modules/') + '/' + subdirectory + '/' + file + '.' + extension
return
])
And this is how I try to execute it (on Windows machine with typescript and coffeescript-to-typescript modules installed globally):
C:\development\mp-frontend>coffee-to-typescript -cma app\modules\core\services\FileRequire.coffee
error compiling app\modules\core\services\FileRequire.coffee
app\modules\core\services\FileRequire.coffee:4:6: error: unexpected TERMINATOR
#resolver = (subdirectory, extension) ->
^
1 files failed
and
C:\development\mp-frontend>coffee-to-typescript -c app\modules\core\services\FileRequire.coffee
Error: spawn tsc ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
Can anyone tell me what's going on? The TERMINATOR error seems to be a random error happening with coffeescript, although the application compiles with grunt and works perfetcly fine (it does transpile down to javascript afterall, so the code has to be proper coffee).
The tool seems completely useless so far... please point me on what am I doing wrong.
I received the same error message as you did. However, it seems that proper installation process for the tool is:
sudo npm install -g coffee-script-to-typescript
sudo npm install -g tsc # This is the step that helped me.
It works for me on Ubuntu 15.04.
The tool seems completely useless so far... please point me on what am I doing wrong
I would recommend just compiling the coffescript to JavaScript, and then start using the JavaScript as TypeScript i.e. start adding annotations slowly and migrating to ES6 features like classes.
I've followed this example to try and add a record to MongoDB database.
When trying to run ./server/server.js I get the following message (at 2:22 in video):
"C:\Program Files (x86)\JetBrains\WebStorm 9.0.1\bin\runnerw.exe" "C:\Program Files\nodejs\npm" server.js
CreateProcess failed with error 193 (no message available)
Process finished with exit code 0
The node.exe path is right but don't know why I'm getting this error and can't find information on debugging it.
I got the same error while using WebStorm with Babel as the Node executable. After re-installing the dependencies, the correct path to the babel-node executable was node_modules\.bin\babel-node.cmd.