Receiving TS2304: Cannot find name 'File' | TS2304: Cannot find name 'ReadableStream' when running "npm run tsc" command - node.js

I have a nodejs application using "watson-developer-cloud" module. Included this module using "npm install --save watson-developer-cloud".
I see the issue below when running "npm run tsc".
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,35): error TS2304: Cannot find name 'File'.
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,42): error TS2304: Cannot find name 'ReadableStream'.
I am running this on Mac.
node version 10.15.3.
I found few articles asking to set path to node bin directory and reload terminal.
I did that - although running into the same problem again.
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,35): error TS2304: Cannot find name 'File'.
node_modules/ibm-cloud-sdk-core/lib/content-type.d.ts(4,42): error TS2304: Cannot find name 'ReadableStream'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-program#1.0.0 tsc: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-program#1.0.0 tsc 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! /root/.npm/_logs/2019-03-25T14_29_06_333Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! my-program#1.0.0 build: `npm run tsc && npm run tslint`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the my-program#1.0.0 build 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! /root/.npm/_logs/2019-03-25T14_29_06_351Z-debug.log
ERROR: Service 'my-program' failed to build: The command '/bin/sh -c npm run build' returned a non-zero code: 2```

The File and ReadableStream types are defined in the dom TypeScript library.
Try adding it to your tsconfig.json:
{
...
"compilerOptions": {
"lib": [
...
"dom"
]
}
}

Related

NPM run dev error after requiring Tailwind CSS

I'm just dipping my toes into using Laravel for the first time, and I've had many issues so far. I've figured them out myself so far, but this one is driving me crazy!
After adding the line require('tailwindcss') in my webpack.mix.js file, I keep getting the following error when I run.
npm run dev
✖ Mix
Compiled with some errors in 452.52ms
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read property 'config' of undefined
at getTailwindConfig (/home/timothy/blog/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:81:62)
at /home/timothy/blog/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:124:92
at /home/timothy/blog/node_modules/tailwindcss/lib/processTailwindFeatures.js:41:11
at plugins (/home/timothy/blog/node_modules/tailwindcss/lib/index.js:20:104)
at LazyResult.runOnRoot (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:339:16)
at LazyResult.runAsync (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:393:26)
at LazyResult.async (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:221:30)
at LazyResult.then (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:206:17)
at processResult (/home/timothy/blog/node_modules/webpack/lib/NormalModule.js:751:19)
at /home/timothy/blog/node_modules/webpack/lib/NormalModule.js:853:5
at /home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:399:11
at /home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:251:18
at context.callback (/home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at Object.loader (/home/timothy/blog/node_modules/postcss-loader/dist/index.js:142:7)
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
webpack compiled with 2 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `mix`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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/timothy/.npm/_logs/2022-01-18T04_24_37_451Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev 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/timothy/.npm/_logs/2022-01-18T04_24_37_460Z-debug.log
I've looked into my version of Node.js and PostCSS being an issue, as my version of node.js has been an issue that caused other problems I've had so far, but those two seem fine. If it matters, this is a Laravel project created with Composer on Ubuntu 20.04 with Laravel installer 4.2.9.
Just run this comman. Tailwind config file is missing.
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init

Cannot find module 'util.js' after command npm init on Windows 10

I installed npm before and work with many projects along with express.js , but today I opened a folder and willing to start a new project. But after npm init command , it says util.js module not found.
I found this util.js file on this root directory npm\node_modules\npm\node_modules.
How to solve this issue?
F:\Pulok\HabluTheGreatDoc\Projects\ReactApp\event-booking>npm init
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module './util.js'
npm ERR! Require stack:
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\node_modules\libnpx\index.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\init.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\lib\npm.js
npm ERR! - C:\Users\Sabbir\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sabbir\AppData\Roaming\npm-cache\_logs\2020-07-12T06_33_44_670Z-debug.log
Edit:
npm version: 6.14.5.
node.js version: v12.16.1
I have also tried running npm cache clean --force and npm init --yes, however I continue to get the same error message.

Error using Framework7 and service.js for hosting in the local host

when i clicked the npm run service. This error is what i am getting
I have used the same app in the following link:
https://github.com/valnub/f7-node-autocomplete-search-demo
framework7-react-app-template#3.0.0 service C:\Users\Tallam Tharun Sai\auto-complete
PORT=3001 nodemon service/service.js
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! framework7-react-app-template#3.0.0 service: `PORT=3001 nodemon service/service.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the framework7-react-app-template#3.0.0 service 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! C:\Users\Tallam Tharun Sai\AppData\Roaming\npm-cache\_logs\2020-07-10T18_16_54_175Z-debug.log
The answer for this is.
I have deleted the Package.json and Node modules from the project and again followed the steps to install the npm as (npm install).
Then I have the installed my npm app successfully.

Trouble building react-webapp with ESLint; ESLint couldn't find the config "developit" to extend from

My react app works as normal using npm start, but when I try npm run build I got trouble.
Oops! Something went wrong! :(
ESLint: 6.8.0.
ESLint couldn't find the config "developit" to extend from. Please check that the name of the config is correct.
The config "developit" was referenced from the config file in "/home/user/beregning-innsikt/beregning-innsikt-webapp/src/main/webapp/node_modules/#babel/preset-modules/package.json".
If you still have problems, please stop by https://gitter.im/eslint/eslint to chat with the team.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! beregning-innsikt-webapp#2.0.0 lint: `eslint 'src/**/*{.ts,.tsx}'`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the beregning-innsikt-webapp#2.0.0 lint 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/user/.npm/_logs/2020-08-11T08_20_44_975Z-debug.log
ERROR: "lint" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! beregning-innsikt-webapp#2.0.0 prebuild: `npm-run-all clean lint && aurora-mi git`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the beregning-innsikt-webapp#2.0.0 prebuild 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/user/.npm/_logs/2020-08-11T08_20_45_002Z-debug.log
The Babel config file contains this:
"eslintConfig": {
"extends": "developit",
"rules": {
"no-console": 0,
"new-cap": 0
}
},
I have tried node v 13.7.0 and 14.1.0.
Does anybody know how to solve this problem?
Seems like it is linting node_modules too
To fix this you can create file .eslintignore in your root directory and add node_modules/ folder to your eslintignore file

nightwatch Error "Error: ENOENT: no such file or directory .../examples/pages"

I am starting to use nightwatch (followed this tutorial -
https://blog.risingstack.com/end-to-end-testing-with-nightwatch-js-node-js-at-scale/)
I created a folder in "/Users/luisfranqueira/fyde/experiments"
And inside I have the structure:
/bin /reports /tests nightwatch.json
when running the tests follow all instructions in the tutorial - I run the command "npm run test-e2e"
I get the following error:
> # test-e2e /Users/luisfranqueira
> nightwatch
There was an error while starting the test runner:
Error: Cannot read source folder: /Users/luisfranqueira/examples/tests
at /Users/luisfranqueira/node_modules/nightwatch/lib/runner/run.js:203:21
at /Users/luisfranqueira/node_modules/nightwatch/lib/runner/walk.js:97:18
at FSReqWrap.oncomplete (fs.js:152:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # test-e2e: `nightwatch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # test-e2e 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! /Users/luisfranqueira/.npm/_logs/2017-12-05T12_23_49_345Z-debug.log
I know that this is probably a miss configured path, however, I don't know where to change it....

Resources