lwc-services is not recognized as an internal or external command - salesforce

I am trying to run a hellow world app in LWC open source and after "npx create-lwc-app my-app" when I cd in the dir and run "npm run watch" I get the below error.
E:\Development\LWC\workspace\dev>npm run watch
> dev#0.0.0 watch E:\Development\LWC\workspace\dev
> lwc-services watch
'lwc-services' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dev#0.0.0 watch: `lwc-services watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dev#0.0.0 watch 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\ABC\AppData\Roaming\npm-cache\_logs\2019-12-24T16_31_47_970Z-debug.log
Have tried to install "npm install --global --production windows-build-tools" again, trierd to manually install npm i lwc-services -g but it has an error 'rollup-plugin2.02 is dprecated update your dependency' but I donot know if that is the issue here , reistalled the nmp but still not working.

You may try running 'npm run watch' after 'npm i' command.
The same issue has been asked here

I was instructed to do npm install -g lwc-services. There were several warnings, including "deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies."
That one seemed more serious than all the others, so I did npm install chokidar. That came in without any problems. Then I retried the previous command. I don't know if the Chokidar was such a big problem, but at least I was able to do the basic exercises and catch up with the rest of the class.

Related

How to set React app variables in NPM start script

so the npm start in my package.json looks like this
"start": "REACT_APP_Environment=development react-scripts start",
This worked fine for previous developers on the project, possibly because they were on MacOS, that's not the case for me on windows, when I run I get
> REACT_APP_Environment=development react-scripts start
'REACT_APP_Environment' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! enterprise#0.1.0 start: `REACT_APP_Environment=development react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the enterprise#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\Omar\AppData\Roaming\npm-cache\_logs\2019-09-22T15_12_59_217Z-debug.log
I can fix this by removing the environment variable from the start script and running by the command set "REACT_APP_Environment=development" && npm start, but this is not convenient, how can I have it all included and work properly on windows in my start script? thanks
I would recommend checking out .env, seems like it might solve your problem
npmjs.com/package/dotenv

I got this errors while trying to create css modules using npm run eject

I am trying to implement css modules running 'npm run eject' but I am getting errors
I ran "npm run eject" after making git commit. Now I am stuck with some errors that looks like am missing something but I cant figure it out yet.
This is the log of errors I get after running npm run eject
Remove untracked files, stash or commit any changes,
and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app#e.l.e eject:
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app#e.l.ΓΈ eject script.
npm ERR! This is probably not a problem with npm.
There is likely addi
npm ERR! A complete log of this run can be found
in:
npm ERR!
CSS Modules are already supported in React (reference).
You don't need to run npm run eject anymore (unless your aim is to still customize some things yourself).
Just name your css file like this: [name].module.css
It seems you have some untracked by Git. From the error log you can find few ways of the problem solving:
1) add files to new commit using terminal:
git add .
git commit -m 'some message'
2) if you don't need untracked file, you have to find and delete them

npm start does not work for ract template project

Running npm start after npm init does not work due to reported missing react-script library.
It is on my Windows 10 machine; I tried uninstalling and reinstalling node but it did not help.
I can only run my project by typing
>node .\node_modules\react-scripts\bin\react-scripts.js start
otherwise if I run:
>npm start
I can see errors pasted below.
reactapptest#0.1.0 start C:(...)\reactapptest
react-scripts start
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! reactapptest#0.1.0 start: react-scripts start
npm ERR! spawn bash ENOENT
npm ERR!
npm ERR! Failed at the reactapptest#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It looks like something is wrong with my path but I am not sure and I do not know how to solve it.
The specific error you are getting points out that bash is not available. Now bash is a shell for Unix and Unix-like environments, it is not typically installed on Windows by default. (Though it is available for Windows as well through MinGW.)
You are working on Windows, you should not need bash with react-scripts. Try upgrading npm with npm install -g npm#latest to see if this is caused by an old and broken version of npm on your system.
EDIT: Also, you may have previously configured npm to use bash. See: how to set shell for npm run-scripts in windows and note that you are pretty much trying to do the opposite, so if you have custom configuration you might want to try removing it (also explained in the linked accepted answer).

Troubles after upgrading react-native to 0.56

i have troubles updating the new version of react-native which appears to improve vastly and a lot of features.
After reading this article :
https://facebook.github.io/react-native/blog/2018/07/04/releasing-react-native-056
I've started to run this command : https://facebook.github.io/react-native/docs/upgrading.html
All goes well, the application is built after running react-native run-ios
The problem is the bundle which is buggy :
node node_modules/react-native/local-cli/cli.js start "--reset-cache"
Scanning folders for symlinks in
/Users/julestruong/Dev/BAP/flex/v1/flex-mobile-app/node_modules (14ms)
warning: the transform cache was reset.
Cannot find module 'metro/src/transformer'
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! flex#0.0.1 start:
node node_modules/react-native/local-cli/cli.js start
"--reset-cache" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at
the flex#0.0.1 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:
Tries :
remove node_modules
start --reset-cache
delete package-lock.json and reinstall.
Nothing works ...
If you're using typescript you'll need to upgrade react-native-typescript-transformer to 1.2.10 since metro moved the transformer it relies on.

create-react-app npm run build fail to minify watson node sdk

I am new to React and I am trying to build a react app using create-react-app and Watson node-sdk. Everything works fine in development mode after running npm start. But when I try to build a production package using npm run build and below is the error I receive.
e:\Microsoft\Workspace\React\myapp>npm run build
> myapp#0.1.0 build e:\Microsoft\Workspace\React\myapp
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/watson-developer-cloud/lib/helper.js:31
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp#0.1.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! C:\Users\yk\AppData\Roaming\npm-cache\_logs\2017-09-
20T09_40_36_144Z-debug.log
The line that giving error is let missing; and seems like the let is causing the issue. Is there anything I can do with this?
Encountered this problem today. the doc suggests some solutions:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
Fork the package and publish a corrected version yourself.
If the dependency is small enough, copy it to your src/ folder and treat it as application code.
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify

Resources