I am trying to install sass and I don't understand why I keep running into the issue shown below
I understand I should follow the instructions and run npm audit fix but when I run the command, I get an error of no package.json found, and yes, that is so because sass wasn't installed at all and thus no node-modules and the json file, how do I fix this issue?
Try running the npm init command at the root of your project to generate the package.json file and re run the command to install sass.
Related
I am new to React js, While using npm start after install the react not working,I tried every process but no use. Thanks in advance
Error
cricdost#0.1.0 start C:\xampp\htdocs\cd-web
react-scripts start
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"webpack": "4.41.2"
Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:
C:\xampp\htdocs\node_modules\webpack (version: 4.39.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.
Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
Check if C:\xampp\htdocs\node_modules\webpack is outside your project directory.
For example, you might have accidentally installed something in your home folder.
Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed webpack.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cricdost#0.1.0 start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cricdost#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\XSC-10261\AppData\Roaming\npm-cache_logs\2020-02-20T04_56_31_650Z-debug.log
I had faced the same error. The solution that I found is to do the step-6 as described in Error message. That is to delete "webpack" folder of node_module folder under your root projects directory. For example
Assume that you installed "npm install create-react-app" in D:\Projects folder.
And then you ran "npx create-react-app firstproject" in D:\Projects folder. So, your actual react project folder is "D:\Projects\firstproject".
So, what I want to tell is don't delete "webpack" folder in "D:\Projects\firstproject\node_module" directory. Instead, delete "webpack" folder in "D:\Projects\node_module" directory.
And then, you can run "npm start" command in your actual react project directory "D:\Projects\firstproject".
I hope, this will work for you.
I'm getting this error when I try to run the command gulp watch-bs for my UnderStrap child theme for WordPress. I've been using this command for a year with no problems, but I received this error today when I updated my node and npm to their latest versions.
ReferenceError: internalBinding is not defined
at internal/util/inspect.js:31:15
at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
at require (C:\xampp\htdocs\node_modules\natives\index.js:110:12)
at util.js:25:21
at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
at require (C:\xampp\htdocs\node_modules\natives\index.js:110:12)
at fs.js:42:21
at req_ (C:\xampp\htdocs\node_modules\natives\index.js:137:5)
at Object.req [as require] (C:\xampp\htdocs\node_modules\natives\index.js:54:10)
at Object.<anonymous> (C:\xampp\htdocs\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:99)
I've read here that, in order to resolve the issue, I need to run this command:
npm install natives#1.1.6
but this did not help resolve the issue.
Am I missing something else?
I ran into the same issue as you. To fix it, I added the following to my package.json in the devDependencies section
"natives": "^1.1.6"
I had the same error after upgrading node to v10.16.0
I ran the following which solved my issue:
rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm install
After closer inspection, it would seem that the generated tree in package-lock was outdated.
I also faced the same problem and then I fixed by the following command:
npm install natives#1.1.6
May be helpful if someone having same issue.
updating node to latest version requires above package.
I recently ran into the same problem after installing node. Similar to #Dv-Learner answer, What fixed it for me was:
npm install natives#1.1.6
npm rebuild node-sass
the bit about rebuild node-sass was required for my machine (Windows)
#Student 22, in addition to Lloyd's solution, I simply updated my version to the most recent version for gulp using the command below ( Local Version 3.9.1 to Local Version 4.0.0) and I didn't run any additional commands.
npm install gulp-update
Reference: https://github.com/nodejs/node/issues/24985
Good luck!
In my case, I downgraded my node version from 10.16.0 to 8.11.4 which was required by my current project by this command
sudo n 8.11.4
Had the same error. Solved it by installing graceful-fs.
It seems that natives package is now deprecatd and you should install graceful-fs instead.
I had node v10.16.1 and glup local version 3.9.1. I ran 'npm install graceful-fs' and glup no longer gave the error in this question.
(Can't comment yet, so an answer).
Try this, it's working for me:
npm install -g graceful-fs graceful-fs#latest
I have a NodeJS project that was started long ago. It has many packages that were installed before I understood the --save flag. A few versions ago npm decided that it would delete packages that are not mentioned in package.json (an insane thing to do). This causes a terrible problem.
Now I understand --save and use it properly. However, I cannot figure out a way to update package.json with packages that are not listed.
Is there some way to cause npm or some other program to look at a project and add missing dependencies? I'd be happy enough if it completely recreated the dependency structure.
Suggestions?
UPDATE : npm 3.5+
Remove everything from package.json and run: npm init --yes.
This will recreate the package.json with dependencies, but not the devdependencies.
npm 3
If your're on Unix based systems, from inside your project root folder, with a package.json file already created (npm init, as you mentioned), run:
npm install $(ls node_modules/) --save
and it will reinstall the packages, and save them into package.json as dependencies
So i've been creating a desktop application using electron. The problem is that when I run my application using npm it doesn't show any error about a missing module but when i package it and run it this error shows
I'm sure that i've install mysql module using npm install -g mysql and npm install mysql in the project directory. It's all working fine when i run the unpacked version of the application
Assuming that you have installed mysql if not please install mysql npm install mysql --save-dev
Hi I also ran in same error I tried everything possible but nothing seems to work , after several hit and trial I was able to fix it and in the end realize that it was all happening because of
When I installed MySQL module I never saved it (--save-dev)
And electron-packager was not able to locate it when I pack it because was not mention in package.json
A solution might locate mysql folder in node_module folder and delete
then install it npm install mysql --save-dev
or manually
add it under dependencies in package.json file
I have installed gulp both globally
sudo npm install --global gulp-cli
and locally
npm install --save-dev gulp
/usr/local/bin/gulp exists, and ./node_modules/gulp and ./node_modules/gulp-cli exist.
When I try to run gulp on the command line, I get the common error
$ gulp
[00:55:43] Local gulp not found in ~/dev/myProj/play-java-seed
[00:55:43] Try running: npm install gulp
One thing that I noticed is that if I run gulp in some random directory (~/foo), the error message is that the local gulp is not found in that directory. If I run it from the correct directory (~/dev/myProj/play-java-seed/ui) then the error references the parent directory.
There is in fact no gulp installed in the directory in the error message; it is installed on directory lower.
/usr/local/bin/gulp is a symlink to a file with these contents:
#!/usr/bin/env node
'use strict';
require('../')();
Is the .. in that file correct? It seems strange, but I have not looked at it closely before.
If the OS matters, I am running 32 bit Ubuntu 16.04.
devDependencies in my package.json includes both gulp and gulp-cli
Rico Kahler had the correct answer in his comment.
When I looked at the machine (instead of going off of my memory), I saw that the gulp file was one directory higher than it should have been.
The error message did have a clue toward this: it gave the directory holding the gulpfile, not the current directory.