I want to program a Minecraft Bedrock Addon with JavaScript, just installed these packages "npm install -g yo" and "npm install -g generator-minecraft-addon". This all worked great. Now I want to continue with the settings of the mod, for this I have entered "yo minecraft-addon" in the terminal and this error message appears:
https://i.stack.imgur.com/oUezi.png
This is the error message.
I hope you can read it. Thanks in advance.
Create a package.
json file, on the command line, in the root directory of your Node. js module, run npm init : For scoped modules, run npm init --scope=#scope-name. For unscoped modules, run npm init.
Related
I ask this question because I have been installing nodemon with npm and I see the results of installing through the suggested command at first sight, at the right side of the screen:
npm i nodemon
It is different from the installation instructions you can read above, on the Installation section. There we see:
global installation:
npm install -g nodemon
install nodemon as a local project dependency:
npm install --save-dev nodemon
The thing is, what is difference between
npm i nodemon
and
npm install -g nodemon
When I use the first command it tells me typical "nodemon is not recognized as internal or external command, operable program or batch file". To solve it I must install globally.
When you run npm i nodemon nodemon is installed as a local project dependency, to run nodemon on the CLI you would have to provide the pull path to it's installation, typically you would want to make this reference in your project's package.json file's scripts property, for instance:
{
...
"scripts": { "nodemon": "nodemon index.js" },
...
}
This can then be executed by running npm run nodemon.
On the other hand running npm install -g nodemon or npm i -g nodemon installs nodemon on the global scope where it is referenced in your system PATH variable, that way you can easily call nodemon on the CLI and since it's full installation path is referenced in your system PATH variable it would execute like every other CLI command.
Browser is made available to the current project (where it keeps all of the node modules in node modules) after local installation. It will not be available as a command that the shell can resolve until you install it globally with npm install -g module, in which case npm will install it in a location where your path variable will resolve this command. Typically, this is only good for using a module like so var module = require('module');
This documentation will help.
I have been trying to install some packages and libraries like react-dom and react-icons but I have not been able to get any luck.
Every time I run an npm install command such as:
npm install react-icons --save
or:
npm install react react-dom
All I get is a blank line in terminal and my install doesn't go through.
This is irregardless of whether I add --save or not.
It is also irregardless of whether I use something like an integrated terminal in VS Code or my native terminal application.
npm start works and such so I'm thinking its just my install command that is failing.
It might be the case npm is not istalled? Do you have Node.js installed? NPM is included with Node.js installation. In order to check open your terminal and type npm -v. If it's installed you are going to see something like v8.10.0.
When I run npm start, I get this error. What is the solution for this?
This issue has been addressed here, you can refer to it.
Complete solution is
First add Poweshell to PATH as %SystemRoot%/system32/WindowsPowerShell/v1.0.
open powershell as admin and write this command Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force.
last thing fire npm-windows-upgrade.
Check your node version. update node & npm
try sudo npm start if you are in macOS or linux
try to download create-react-app again npm i -g create-react-app
try to create the app in another folder create-react-app APPNAME
Still not working? Then delete node module folder and run npm install
Not yet? delete both node module & package-lock.json and npm install
Try to run on another PORT
I installed npm-run-all and also configured the environment variable (which may or may not be not required) on my Windows machine but am getting an error:
'npm-run-all' is not recognized as an internal or external command,
operable program or batch file
I am trying to build my current project with npm run build which includes the script where the error is thrown:
npm-run-all -p build-css build-webpack
Do I have to do any additional things to make it run?
Make sure the npm-run-all is in your package.json devDependencies.
If npm-run-all is present in your package.json, run npm i
If not present install it, run: npm i npm-run-all -D
If error is still present, follow these steps:
Remove node_modules folder: run rm -rf node_modules
Install all dependecies: run npm i
Hope this helps!
You may just need to run the following command first (from the directory with the package.json file)
npm install
Please do that like this.
npm i npm-run-all -g
And then this issue will be fixed.
You have a couple of options here, besides installing npm-run-all as a global package as suggested by #Vaibhav in the comments:
1) Create an NPM script
The package.json file has a scripts section which can used to define shortcuts for anything you need to run while you're working on your app. There are some pre-defined scripts, like run or test than can be executed with simply npm start/npm test or you can define anything you like and then run it with npm run my-script-name. You could try:
{
"scripts": {
"start": "npm-run-all -p build-css build-webpack"
}
}
Any NPM module referenced here "just works" (i.e. the path to the executable is resolved under the hood by NPM)
2) NPX
In newer versions of NPM (i.e. >= 5.2 or so), the "NPX" executable is provided. This has a similar effect to running commands inside an NPM script. You would run:
npx npm-run-all -p build-css build-webpack
Again, the path would be automatically resolved.
If you have an older NPM install, you can also install it separately:
npm install -g npx
npm install -g npm-run-all
Works for me.
Double check if npm-run-all is in your package.json devDependencies.
I had same problem while using code editor Brackets.
To resolve the error, I did the following steps.
Add nodejs new system variable to your PC under Control Panel -> System -> Advanced System Settings
;C:\Program Files\nodejs\
After that, re-run command:
npm
I don't know if this would help anyone, but I got this error because I was doing nodemon server.js instead of nodemon server/server.js. I wasn't in the right folder!
Did you reopen the terminal after you installed node?
If you have installed npm with the current terminal window open. Your terminal window will not have loaded the latest path settings (with npm location) to find the npm application to run the command. In this case try below steps .
Try closing the current terminal session.
Reopen a new session.
Try the command again ( will pick up the new path settings with npm installed)
This worked for me.
npm audit fix --force
Also you can try downgrading your autoprefixer, seems version 10.0.0 doesn't work well with postcss
npm i autoprefixer#9.8.6
I have been using nodemon for past few months now. It's just that today I got this error. I tried uninstalling nodemon and the reinstalled it. I also forced install it. Nothing worked. Whenever I run the nodemon command
bash: nodemon: command not found
pops up.
There are other answers too and I have looked them all up. They haven't worked for me.
I have faced this error once, and in my package.json, I updated the nodemon location and it worked.
Below code is in my package.json
"start" : "./node_modules/.bin/nodemon server.js"
and then after running npm start it works.
If you don't have nodemon installed globally try to do that.
I had the same issue but after installing it globally whenever I ran the command it work
sudo npm install -g nodemon
I hope this will help
This is down to your global variables.
Ensure npm is included in your PATH var and there is no conflicting npm directories
echo %PATH%
If it is, get your npm root, Ensure the npm in your global path matches the npm root
npm root -g
Navigate there and ensure the "nodemon" file is there. This is where all the npm install -g files are installed.
If not run npm i nodemon -g and confirm that it has been added to the npm root folder.
Having all of these boxes ticked will get these globals are working for you again.