I run express generator and I get this error - express

On my ubuntu terminal, when I run:
express --view=no-view notevi_api
The files are note generated correctly, I don't get my app.js and this shows up:
create : notevi_api
install dependencies:
$ cd notevi_api && npm install
run the app:
$ DEBUG=my-application ./bin/www
fs.js:128
throw new ERR_INVALID_CALLBACK();
^
TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
at maybeCallback (fs.js:128:9)
at Object.writeFile (fs.js:1163:14)
at write (/usr/lib/nodejs/express-generator/bin/express:232:6)
at /usr/lib/nodejs/express-generator/bin/express:197:5
at /usr/lib/nodejs/express-generator/bin/express:247:11
at /usr/share/nodejs/mkdirp/index.js:30:20
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
How can I solve this ERR_INVALID_CALLBACK?

I found the answer.
I had to install express as a root.
sudo npm install -g express-generator
I found this on another stackoverflow post:
express --view=hbs myapp getting [ERR_INVALID_CALLBACK]: Callback must be a function

Related

SvelteKit doesnt work - src\app.html does not exist issue

I'm installed SvelteKit but when I'm trying "npm run dev" I'm getting an error:
src\app.html does not exist
at validate_template
at load_config
at async get_config
at async
But in my src folder I have app.html file! :/ What's wrong?
When you start sveltkit app first you write
npm init svelte#next my-app
in your terminal,
next, this is very important you go to your app that you have created:
cd my-app
then you install all dependencies in "my-app":
npm install
and then you run your server in in "my-app":
npm run dev

Expo fails to build, Request failed with status code 400

I'm trying to build a project in expo react native project.
My expo version is 3.2.2, sdkVersion is 35.
When I ran in cmd (on Windows 10)
set EXPO_DEBUG=true
expo build:android -c
I got:
Request failed with status code 400
Error: Request failed with status code 400
at createError (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\Jonny\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:237:11)
at IncomingMessage.emit (events.js:203:15)
at endReadableNT (_stream_readable.js:1145:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
I'm tried to update expo version, sdkVersion, the version in react, check for internet connection.
Expo login and logout works fine. I don't have any proxy in my network.
I don't have any clues for what search or how to fix this problem.
Seems was a error in expo-cli version 3.2.2.
The update 3.2.3 fixed for me.
I have fixed the issue by using this command
Move to your root folder then type this command in your terminal
npm install -g expo-cli
I had two versions of expo-cli installed (one via yarn global install expo-cli and one as a dev dependency in project yarn add -D expo-cli). This started working for me after I removed the global expo-cli:
yarn global remove expo-cli
and used the local version in my project instead:
yarn run expo-cli start
Run those following command, then we are good to go.
$ yarn global remove expo-cli && yarn global add expo-cli
$ rm -rf node_modules/ yarn.lock && yarn install
$ yarn run start

vue js app yarn serve is failing with exit code 1.?

I am building frontend of a web app using vuejs. till yesterday my app was running fine but all of sudden today yarn serve command is throwing an error.
Error: watch /home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:232:14)
at FSWatcher.NodeFsHandler._handleDir (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:414:19)
at FSWatcher.<anonymous> (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:462:19)
at FSWatcher.<anonymous> (/home/abhey/Documents/abhey/astrix/astrix_final_project/ecommerceFrontend/node_modules/chokidar/lib/nodefs-handler.js:467:16)
at FSReqWrap.oncomplete (fs.js:153:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I did try to look into the documentation but it was of no use. I also tried to start a new project altogether but it was of no help. any suggestions? if it's of any use I am using Linux Mint 19 as my os.
Well I had the same problem with npm.
You can try to clean the npm cache remove the node module folder and re install the dependencies try this code in your terminal.
cd ~
sudo rm -rf .npm
cd <package folder where node module exist>
npm cache clean
rm -rf node_modules
npm install
try same logic with yarn it will solve your problem.

Vue Cli's default has console errors?

I'm trying to create a project using Vue Cli using the following lines,
$ npm install -g vue-cli
$ vue init webpack my-project
$ cd my-project
$ npm install
$ npm run dev
And in the console of the build, it has the following error,
Uncaught TypeError: Cannot read property 'indexOf' of null
at Object.extractShopifyDomain (content.min.js:14)
at Object.extractCurrentDomain (content.min.js:14)
at new <anonymous> (content.min.js:16)
at content.min.js:15
Is it an issue with the current Vue Cli or am I doing something wrong? I haven't touched any scripts or edited anything yet. How do I resolve this?
I encountered the same thing. Discovered it was the Coupons at Checkout chrome extension causing the error.
Try to update nodejs & npm. Remove node_modules folder and run npm install again. Maybe it will help.

Truffle command not found after installation

I installed truffle through npm with the following:
sudo npm install -g truffle
but when I run truffle list on the console it just gives me
bash: truffle: command not found
I had a similar problem. I ran npm i -g truffle and then when I tried to run truffle init I got an error: zsh: command not found: truffle. What solved it for me is to create a local node_modules with truffle installed in it, and then run that copy.
run npm init and make a new npm project
run npm i truffle
run ./node_modules/.bin/truffle init and it should work!
Please make sure you have the latest version of npm and node installed. I had the same issue, I updated npm and node to latest version and it worked.
npm install -g truffle works.
After installing truffle:
npm install -g truffle
Run on your project folder:
npx truffle init
I did it on a Virtual box and had the same issue, but it worked after I restarted the computer. Hopefully that works for you too
You should add the following to your path system variable.
C:\Users\UserName\AppData\Roaming\npm
(This folder contains the truffle.cmd file)
I have tried and it works.
I tried everything. Followed the instruction on official truffle website and above answers.
Still it didn't seem to worked.
Finally, this worked for me.
Go to C:\Users\Username\AppData\Roaming\npm
There you will find truffle.cmd Double click on it and your done.
npm i truffle does the exact same thing as npm install -g truffle except that installs it globally, and without -g it will be installed on the local folder. Try to update the npm, node, and probably you have a broken node installation from previous versions.
Using npm install -g truffle worked for me instead of npm i truffle
Nothing above worked for me, but I did:
nix truffle unbox react
truffle develop
atom . //opens up the react file project in the atom platform
Try to start with your command like
npx truffle <your command>
You should add C:\Users\UserName\AppData\Roaming\npm (it contains truffle.cmd file) to the path user variables. I have tried and it works
If you have a custom path for your packages, then make sure that you are exporting it when the terminal loads.
For bash:
nano ~/.profile
For zsh:
nano ~./zshrc
And add your custom path, most of the time this will be "npm-global".
export PATH=~/.npm-global/bin:$PATH
These are two simple steps the properly solve this problem for Linux Users:
1- Configure npm to install software globally in your home directory as follows :
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
2- If you are using bash, then execute the following:
echo -n "export PATH=~/.npm-global/bin:$PATH" >> ~/.profile
However, if you are using zsh instead, then execute the following command:
echo -n "export PATH=~/.npm-global/bin:$PATH" >> ~/.zshrc
Note that, if you are using both bash and zsh, it is better to execute the two commands above.