PS C:\Users\Mahima\OneDrive\Desktop\StackOverflow-clone> yarn start
yarn run v1.22.4
warning package.json: No license field
error Command "start" not found.
I have installed all the required dependencies along with yarn still it is showing the error "warning package.json: No license field"
The quickest solution is to add following to your package.json file
{
"private": true
}
Related
Hello I downloaded a react project from https://github.com/fabiau/jc-calendar and when I do npm start I get error messages. I tried to do "NPM Fund" and "NPM Update" and none of them worked. Obviously i have no clue what I am doing so if anyone can point me in the right direction I would apprecaite it.
Before starting dev server you'll have to install the dependencies of the project using npm install , as generally node_modules/dependencies are not part of the repository.
This is mentioned in Readme.md of JC-calender.
Try deleting folder node_modules and package-lock.json if exists and run command npm install
Checkout scripts in package.json in usual case start will be as given below but as per the code you consider npm-run-all package is used so be sure to run npm install
"scripts": {
"start": "react-scripts start",
},
This may help you out https://www.npmjs.com/package/npm-run-all
most of the repositories on GitHub, don't have dependencies installed, after downloading a repository on your local machine, you need to run "npm install". The reason behind this is that npm will look for all the required dependencies of the specified project and install them on your machine, with node-modules, then run "npm start"
yarn start leads to an error saying command "start" not found. In my package.json file there is no script's tag, could that be the issue. Please suggest a fix.
I am trying to install react, the commands being:
npm install -g create-react-app#1.5.2
create-react-app confusion
yarn start
cmd error:
command prompt
package.json:
"name": "confusion",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.1"
}
}
npm uninstall -g create-react-app // uninstall the old create-react-app version (in your case, v1.5.2) to make sure npx uses the latest version in Step 2
npx create-react-app my-react-app-name // npx installs the latest version of create-react-app without requiring a global install. it is included with npm, so no need to install it. if you wish, replace my-react-app-name with whatever you want your project to be called
cd my-react-app-name
yarn start
When I try to run a JS file by babel command it is showing:
"babel-node is not recognized as an internal or external command, operable program or batch file".
I had created 1.js file in this written "console.log("hello world")";
and tried to run with babel-node command but it is showing the above-mentioned error.
you can try install babel's global version
npm install -g babel-cli
Tried many suggestions and finally, I had to explicitly provide the absolute path to babel-node to get it working in scripts definition section in package.json file.
"start": "nodemon --exec ./node_modules/.bin/babel-node src/index.js"
node - v15.5.1
nodemon - v2.0.7
#babel/node - v7.12.10
Make sure that you have got the babel module so that it can be used.
For example by using npm install babel-cli to get a node_modules folder.
Then you can find the runnable in node_module/.bin.
a combination of above solutions worked for me:
npm install #babel/node
npm install #babel/cli
npm install #babel/core
and then I ran npm start and it worked.
Adding npx to the command might help, so exact binary will be executed
nodemon --exec npx babel-node src/index.js
For me the issue was solved by installing 'babel-node' globally by running this command:
npm install #babel/node -g
If your project is based on babel 7, you should run this
npm install #babel/cli #babel/core
install #babel/node , i came across the same problem and by installing this solved my problem
To intall babel packages worked for me
npm i #babel/cli #babel/core #babel/node #babel/preset-env --save-dev
"nodemon --exec ./node_modules/.bin/babel-node src/index.js"
What is currently missing is part of #babel/node. Depending on your project dependency you can install:
npm install #babel/cli
npm install #babel/node
My issue solved by running this command
> npx babel-watch .
you can also use
"start": "babel-node backend/server.js"
For those who struggle making it work for node + nodemon, what helped me was:
Install these deps:
"#babel/cli": "^7.14.5",
"#babel/core": "^7.14.6",
"#babel/node": "^7.14.7",
"#babel/preset-env": "^7.14.7",
"nodemon": "^2.0.12"
You can leave path to babel-node to be relative.
"dev": "nodemon src/index.js --exec babel-node",
This fixed it for me:
npm ci
(npm clean install removes node modules and then installs them again)
After trying everything here, it still didn't work. Eventually I got it working by removing the folders containing the executable (which for me was node_modules/.bin/).
Before:
"scripts": {
"babel": "node_modules/.bin/babel src/index.js -o dist/assets/bundle.js"
}
After:
"scripts": {
"babel": "babel src/index.js -o dist/assets/bundle.js"
}
yes i also get this error
it was resolved do check 👇
$ npm run dev
server#1.0.0 dev
nodemon --exec babel-node index
[nodemon] 2.0.15
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting babel-node index.js
'babel-node' is not recognized as an internal or external command,
operable program or batch file.
[nodemon] app crashed - waiting for file changes before starting...
after that I
install nodemon globally then it was resolved.
$ npm install -g nodemon
added 2 packages, removed 85 packages, changed 30 packages, and audited 33 packages in 9s
3 packages are looking for funding
run npm fund for details
found 0 vulnerabilities
result was ✅🔥
👇👍✅
$ npm run dev
server#1.0.0 dev
nodemon --exec babel-node index
[nodemon] 2.0.19
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting babel-node index.js
Server is runing 🔥
Confirm that you have these dependencies at a minimum in your package.json:
"dependencies": {
"#babel/core": "7.13.10",
"#babel/node": "7.13.12",
"#babel/preset-env": "7.13.12",
..
},
"devDependencies": {
"nodemon": "2.0.7",
...
}
Then check what script you are running. If you see the problem when running npm run dev and you have something like:
"scripts": {
"dev": "nodemon --exec babel-node ./src/server.js",
..
},
Update your scripts to the following (assuming you don't already have a "start"):
"scripts": {
"start": "babel-node ./src/server.js",
"dev": "nodemon --exec npm start",
...
},
Basically, nodeman is used during dev to hot reload code changes. babel-node itself runs the server, but the issue being faced occurs when installed package is not detected by nodeman.
Although installing #babel/cli globally, might appear to resolve the issue, it's not needed (and frowned upon: https://babeljs.io/docs/en/babel-cli)
In Mac Terminal:
package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
Please include the following file with any support request:
npm ERR! /Users/stickupartist/portfolio/npm-debug.log
stickup-artists-macbook-pro:portfolio stickupartist$ npm init
This utility will walk you through creating a package.json file.
What utility is being referred to?
And next:
Use `npm install <pkg> --save` afterwards to install a package
and
save it as a dependency in the package.json file.
Name: (portfolio)
I type:
npm install <portfolio> --save
And the terminal prints out:
Sorry, name can only contain URL-friendly characters.
What am I doing wrong with my naming? I'm working on my local machine with Meteor, on Mac OS X.
To create the package.json file, you can run npm init (and go through its options) or manually create the file based on these rules.
Here's a simple package.json file:
{
"name": "my-cool-app",
"version": "1.0.0",
"description": "This is my cool app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
},
"author": "Me",
"license": "MIT",
"dependencies": {
"jquery": "1.1.1",
}
}
Now, as far as the error:
Sorry, name can only contain URL-friendly characters.
It means that the package name doesn't meet one of the naming rules, mainly:
package name must not contain any non-url-safe characters (since name ends up being part of a URL)
This is most likely happening because you wrapped your package name in <>.
<> means it is a placeholder for a value. When actually typing it in, you should overwrite it (and anything it wraps) with some appropriate value, in this case a valid package name.
It is how you would define an npm install command, not use it:
Definition:
npm install <package_name_goes_here>
Usage
npm install portfolio
Use: npm init -y
Then install your packages.
That worked for me when I had the same problem.
See nem035's answer to create package.json (just npm init).
For your other problem: in npm install <pkg> --save refers to the name of a package. You can install the package with its name, without brackets. For example, npm install portfolio --save
Log out of the session. Then re-login and try npm install -y. This has worked for me.
I updated npm installed node express,even though it is not creating the jason file. can any one please let me know how to fix this.
ramesh#ramesh-PC MINGW32 ~
$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sane defaults.
See npm help json for definitive documentation on these fields
and exactly what they do.
Use npm install <pkg> --save afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (ramesh)
ramesh#ramesh-PC MINGW32 ~
First initialize your project. Assuming your project lives in directory "sample" then:
cd sample
npm init // This will ask a bunch of questions. you can mostly just hit "enter". it will create the package.json file for you
npm i express --save
using npm init you can create package.json
To clarify a bit on the previous answers, npm install <package-name> and npm install <package-name> --save may fail if you try to run them from a directory that does not have an npm package.json file.
You might type something like npm install crud --save and get some confusing output like this:
npm install crud
npm WARN saveError ENOENT: no such file or directory, open '/Users/youruser/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/youruser/package.json'
npm WARN youruser No description
npm WARN youruser No repository field.
npm WARN youruser No README data
npm WARN youruser No license field.
+ crud#0.0.28
That's not a very helpful error message -- the level is only "warn", and that last line makes it appear that the requested package got installed somewhere. But if you look in your directory, you will see it remains empty. The explanation of this "riddle" is that some package installers (like PHP's composer) will initialize a project and download the package, others (like Python's pip or npm) do not, so you have to initialize the directory and install packages separately.
Run npm init and answer some basic questions about your project, or copy a viable package.json file that follows the format below:
{
"name": "my-great-node-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
}
}
Be careful with the package name! The name cannot match the name of a package you trying to install.
Once the directory has been initialize, you should be able to run your npm install <package-name> --save command and have the package installed into the node_modules directory and have your package.json file updated.
Try not to make any space between words in your project folder name. For instance, instead of "My Portfolio" write it like "MyPortfolio". This worked for me and created json file automatically in my project folder.