Error: Failed to find .env file at default paths - javascript

I recently switched to using dev.env & test.env for a REST API using Javascript and I'm getting the following error:
$ npm run dev
Error: Failed to find .env file at default paths: [./.env,./.env.js,./.env.json]
at getEnvFile
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! taskr#1.0.0 dev: env-cmd ./config/dev.env nodemon src/index.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the taskr#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Is there something I should revise in the way my .env files are stored/accessed?

try:
env-cmd -f ./config/dev.env nodemon src/index.js

Related

How can i solve this problem in react.js?

Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$ npm start
chat-application#0.1.0 start C:\web devlopment\react-chat-application\chat-application
react-scripts start
Could not find a required file.
Name: index.js
Searched in: C:\web devlopment\react-chat-application\chat-application\src
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chat-application#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the chat-application#0.1.0 start 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\Black\AppData\Roaming\npm-cache_logs\2021-09-29T15_56_51_774Z-debug.log
Black#DESKTOP-N04CDRI MINGW64 /c/web devlopment/react-chat-application/chat-application (master)
$
you may have deleted index.js file or renamed it.if you are using react-create-app pipeline then you can't rename that or remove this file so make sure it's present in your src folder inside project dir and if you are using git then run git status it will tell you what you had changed.
index.html has been moved/removed from the /public directory
Does your project have an index.js file in the public directory?
If not you can get the one that Create React App uses here

I tried to run command "npm run start " and it showd up with this error in react js

'react-scripts' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bookbhandar#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bookbhandar#0.1.0 start 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\Laxman\AppData\Roaming\npm-cache_logs\2020-08-22T18_25_37_539Z-debug.log
Can some one help me with this error?
It seems like react-scripts is not installed into your node_modules folder. Try to check if you are running the command on the correct folder and if the react-scripts dependency is in the package.json file.
Otherwise try to delete the node_modules folder and run npm i.

Deploy angular 6 in Azure

I am trying to deploy an example app on the azure portal and am encountering some difficulties.
At first I'm just testing, so I've created an angular app with just ng new poc-pwa-angular-v2. After that I went up to a Bitbucket repository.
In Azure I created a web application and in the deployment options I connected on bitbucket and set my master branch.
I tried to generate the scripts with kudu (deploy.cmd and .deployment), but I got an error on the first deploy.
Can anyone give a tip?
Look at my log.
Command: deploy.cmd
Handling node.js deployment.
Creating app_offline.htm
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'package.json'
Deleting app_offline.htm
Invalid start-up command "ng serve" in package.json. Please use the format "node <script relative path>".
Looking for app.js/server.js under site root.
Missing server.js/app.js files, web.config is not generated
The package.json file does not specify node.js engine version constraints.
The node.js application will run with the default node.js version 10.6.0.
Selected npm version 6.1.0
> poc-pwa-angular-v2#0.0.0 postinstall D:\home\site\wwwroot
> npm run build
> poc-pwa-angular-v2#0.0.0 build D:\home\site\wwwroot
> ng build
'ng' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! poc-pwa-angular-v2#0.0.0 build: `ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the poc-pwa-angular-v2#0.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! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_35_989Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! poc-pwa-angular-v2#0.0.0 postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the poc-pwa-angular-v2#0.0.0 postinstall 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:
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\10.6.0\node.exe" "D:\Program Files (x86)\npm\6.1.0\node_modules\npm\bin\npm-cli.js" install --production
npm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_36_053Z-debug.log
An error has occurred during web site deployment.
Invalid start-up command "ng serve" in package.json. Please use the format "node <script relative path>".\r\nMissing server.js/app.js files, web.config is not generated\r\n'ng' is not recognized as an internal or external command,\r\noperable program or batch file.\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! poc-pwa-angular-v2#0.0.0 build: `ng build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the poc-pwa-angular-v2#0.0.0 build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_35_989Z-debug.log\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! poc-pwa-angular-v2#0.0.0 postinstall: `npm run build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the poc-pwa-angular-v2#0.0.0 postinstall script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_36_053Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11022.3613\bin\Scripts\starter.cmd deploy.cmd
The issue is that on Azure Angular cli is not installed.
You will need to do ng build locally(or as part of your build and release pipe line. You can also use Azure DevOps builds for that where you have 240 build minutes for free) and upload it to (just options):
Azure App service.
Upload it to blob storage and use Azure functions proxy to serve your files.
If you need server side rendering then you will need to upload it as an NodeJs app or part of .net app
Thanks for the time of yours, in this case I removed the package.json script block and went up again and it worked.
...
"version": "0.0.0",
"scripts": {
},
...

Error when using npm vue-cli

Windows 10
node v8.9.2
npm 5.5.1
installed vue-cli through the use of npm but entering 'npm run dev' resulted in an error.
this is error message
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webpack-simple#1.0.0 dev: `cross-env NODE_ENV=development webpack-dev-server --open --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the webpack-simple#1.0.0 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! C:\Users\hansol\AppData\Roaming\npm-cache\_logs\2017-12-08T04_14_50_859Z-debug.log
It appears as though you havent installed the node modules / dependencies.
Please try and run a
npm install
And see if that works
I used to face this problem when the port is busy.
So confirm the port you are opening for the dev server.
you can also change the port using a flag "--port 3000".

Can't run tests on angular sample project

I've cloned Angular Material-Start project. As documentation says:
run npm run tests to start all your Karma unit tests.
But this conmmand gives me an error:
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\DevSoft\\NodeJs\\node.exe" "C:\\Users\\Taras\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "tests"
npm ERR! node v5.7.1
npm ERR! npm v3.8.9
npm ERR! missing script: tests
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:
What do I do wrong? How can I run the tests?
There is no tests script in the package.json file:
https://github.com/angular/material-start/blob/master/package.json
The tests have been disabled:
https://github.com/angular/material-start/commit/3a525fe89581c5b945388c1714ca3e4b64027d1e

Categories