I just want to create a new React app with:
npx start-react-app my_new_app
But I get this error:
npm ERR! code E404
npm ERR! 404 Not Found: crate-react-app#latest
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hugovillalobos/.npm/_logs/2018-12-17T21_01_13_727Z-debug.log
Install for crate-react-app#latest failed with code 1
I attempted to do it with sudo privileges, but I just got the same error.
EDIT
I found that the error rises because I created the React app and then removed the whole directory in order to start over. Now, when I try to use the same directory name in the same parent directory, I get this error. When I use another directory, everything works with no problem.
I guess there should be some global React configurations that must be cleared besides just erasing the directory.
You can try to follow steps here https://www.valentinog.com/blog/react-webpack-babel/ It should work.
npm i react react-dom --save-dev
Related
I have been trying to install or create a react app but I kept getting this error message
" npm ERR! Unexpected end of JSON input while parsing near '...5VmmIPyPaAPmy1Iv3blBY'"
Also:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Madu Emmanuel IP\AppData\Roaming\npm-cache_logs\2020-10-13T11_40_59_715Z-debug.log
Go to your Command Prompt, cd into the desired folder and write:
npm i -g create-react-app
Once done, write:
npx create-react-app <project-name>
It should work perfectly.
I tried creating project using vue create but I get following error all the time
✨ Creating project in C:\Users\....
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '..."^5.8.23","babel-tape'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HariC\AppData\Roaming\npm-cache\_logs\2020-08-01T13_14_04_441Z-debug.log
ERROR command failed: npm install --loglevel error
I have chosen everything in except typescript support and es-lint while creating the app.
What could be the reason?
Try clearing the cache:
npm cache clean --force
Probably the error was due to corrupt cache. Referred to - https://stackoverflow.com/a/47896884/9640177
npm cache clean --force
I am new to react and I am trying to create a new create an app, but whatever I do, I get same error.
:npm ERR! Unexpected end of JSON input while parsing near '...nt":"^7.1.0","babel-p'
I think there is some problem with babel.
C:\Users\Augustus\Desktop>npx create-react-app myapp
Creating a new React app in C:\Users\Augustus\Desktop\myapp.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...nt":"^7.1.0","babel-p'
npm ERR! A complete log of this run can be found in:
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting myapp/ from C:\Users\Augustus\Desktop
Done.
force a reinstall
usually you can fix these kinds of errors by forcing a reinstall
try
npm cache clean --force
or
yarn --force
depending on if you are using npm or yarn for package management
After forcing a reinstall, if you see that you are still getting the same error, check your internet connection. I had the same issue until I switched to a faster provider (in my third world country, internet can be slow at times) after which it immediately installed as it should have.
I am trying to use following bit.dev community reusable component ( semantic-ui-react table ) in my application, link I am trying is as below:
https://bit.dev/semantic-org/semantic-ui-react/table?example=5c920bc8c634f0001a931879
We can use same in application using npm i #bit/semantic-org.semantic-ui-react.table
But whenever I do that following error ( Note : For other #bit modules also we are getting same issue ) :
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/#bit%2fsemantic-org.semantic-ui-react.table - Not found
npm ERR! 404
npm ERR! 404 '#bit/semantic-org.semantic-ui-react.table#latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
I think you get this error because you have not configured #bit as a registry.
https://docs.bit.dev/docs/installing-components.html
I also faced same problem for pulling a component from my private collection. In the official YouTube video registry configuration step is missing.
To install components with npm or yarn we first need to configure #bit as a scoped registry. Bit does it by default as part of the bit login process.
To configure the registry manually, use the npm config command. (For pulling public components)
npm config set #bit:registry https://node.bit.dev
To install private components use npm login. Use your Bit credentials to login.
npm login --registry=https://node.bit.dev --scope=#bit
(This will prompt for user login via CLI.)
I am working on a Firebase server-side code for sending push notifications. To make the code clean, I decided to move some functions to another class which I created and called notificationFunctions.js.
When I do const notificationFunctions = require('notificationFunctions'); at the top of my index.js and call the function from within my sendNotification function, I get an error when deploying my project to the cloud:
⚠ functions[sendNotifications]: Deployment error.
Build failed: exit status 1
npm ERR! Linux 4.4.0-108-generic
npm ERR! argv "/nodejs/bin/node" "/nodejs/bin/npm" "--global-style" "--production" "--fetch-retries=5" "--fetch-retry-factor=2" "--fetch-retry-mintimeout=1000" "install" "/workspace"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/notificationFunctions
npm ERR! 404
npm ERR! 404 'notificationFunctions' is not in the npm registry.
npm ERR! 404 Your package name is not valid, because
npm ERR! 404 1. name can no longer contain capital letters
npm ERR! 404 It was specified as a dependency of 'functions'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! Please include the following file with any support request:
npm ERR! /workspace/npm-debug.log
Functions deploy had errors. To continue deploying other features (such as database), run:
firebase deploy --except functions
I have also added "notificationFunctions": "1.0.0" in my package.json and moved the custom function to node_modules folder.
What is the right way of adding a custom class to Firebase NodeJS?
Edit:
When I follow Doug Stevenson's advise and I remove the custom class from my package.json, and move the class to the same directory as index.js, I still keep getting an error:
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error parsing triggers: Cannot find module 'notificationFunctions'
Try running "npm install" in your functions directory before deploying.
Edit 2
Ok. I figured I have to change the way I import my class to require('./notificationFunctions') and this removes all errors when deploying the project.
Once I run the code on the cloud however, I get this error: FIREBASE WARNING: Exception was thrown by user callback. TypeError: notificationFunctions.getNotificationPayload is not a function
The way I call the function from my code is: const payload = notificationFunctions.getNotificationPayload(userLanguage, senderName, groupName, messageContent, messageType);
If you add code to your project in the functions folder, you don't need to make any changes to your package.json dependencies. npm dependencies are only required for modules that are published to the NPM registry.
What your build is doing now is looking for a node module called "notificationFunctions" on NPM, and that obviously doesn't exist there. You should just put your module code along with all the other code under functions and require() it directly from there.
Also, bear in mind that node_modules is not deployed with your code. Cloud Functions will fetch all the npm dependencies on the server side and make them available to your code.