I tried many times to run npm script I also added the script in the package.json file but its showing some errors actually I am building a website and I needed npm sass to make it but the npm run compile:sass which is my script is showing errors here's the image which is facing the problem.
Here's the script code:
{
"name":"natours",
"version":"1.0.0",
"description":"landing page for natours",
"main":"index.js",
"scripts":{
"compile:sass":"node-sass sass/main.scss css/style.css" <=====
},
"author":"Kishan",
"license":"ISC",
"devDependencies":{
"node-sass":"^4.9.0"
}
}
And here's the error in command prompt:
C:\Users\ANONYMOUS>npm run compile:sass
npm ERR! path C:\Users\ANONYMOUS\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\ANONYMOUS\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ANONYMOUS\AppData\Roaming\npm-cache_logs\2018-06-17T05_39_21_109Z-debug.log C:\Users\ANONYMOUS>
You are missing a comma between node-sass sass/main.scss and css/style.css
it should be node-sass sass/main.scss, css/style.css
It seems the problem is with locating the file, not the formatting of the file or the content that error should be thrown later if necessary.
Are you sure that your package.json is in the folder you are running the command from? Try the "dir" console command in the shell where you are executing "npm start" to check if it is.
Also, depending on what editor you are using I used to make a mistake when I started programming of saving files with the wrong format especially something like package.json.txt if using notepad.
Related
I got the following errors every time I run npm install. How could I solve it?
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path D:\CS\class\didipass/package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'D:\CS\class\didipass\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Local\npm-cache\_logs\2023-02-01T20_19_40_952Z-debug-0.log
I already update to the newest version of npm and I have tried npm cache clear but it doesn't work for me.
Thanks for helping me.
Make sure your terminal is in the right directory. Is your project nested in a folder by chance? The folder you are in in the terminal should be the same folder your project is DIRECTLY in.
In other words: make sure you cd into the direct container of your project. If the filetree looks like this:
my_projects > project_1 > [project content]
Make sure you are in project_1, and not in my_projects.
Let me know if this helps.
I have a problem in angular.json file.
{
"resource": "/e:/P dev/project/Resume_generator/front/angular.json",
"owner": "_generated_diagnostic_collection_name_#1",
"code": "768",
"severity": 4,
"message": "Unable to load schema from 'e:\\P dev\\project\\Resume_generator\\front\\node_modules\\#angular\\cli\\lib\\config\\schema.json': ENOENT: no such file or directory, open 'e:\\P dev\\project\\Resume_generator\\front\\node_modules\\#angular\\cli\\lib\\config\\schema.json'.",
"startLineNumber": 2,
"startColumn": 14,
"endLineNumber": 2,
"endColumn": 66
}
After that I tried npm cache clean and again I got an error
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Samanthika\AppData\Roaming\npm-cache\_logs\2021-07-08T16_01_34_045Z-debug.log
E:\P dev\project\Resume_generator\front>npm cache clean
npm ERR! As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can use `npm install --cache /tmp/empty-cache` to use a temporary cache instead of nuking the actual one.
npm ERR!
npm ERR! If you're sure you want to delete the entire cache, rerun this command with --force.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Samanthika\AppData\Roaming\npm-cache\_logs\2021-07-08T16_02_04_108Z-debug.log
Enter your project and run the following commands:
npm install -g #angular/cli
ng add #angular/cli
Run cache clean with --force
npm cache clean --force
Try followings as mentioned here.
npm install -g npm#latest
npm install -g #angular/cli
First, run this,
npm cache clean --force
If this is not working, you can delete the node modules file and package-lock.json file
Then run,
npm i
I am new to Foundation for Emails and I am just trying to get everything installed, following directions step by step. I have installed Git, and Node.js (the latest version 11.5.0).
I created my project directory (test123) and inside there I am told to run "npm start". I do this and get the following error:
Alexandrus-MacBook-Pro-2:test123 alexcrisan$ npm start
> foundation-emails-template#1.0.0 start. /Users/alexcrisan/Documents/sites/test123
> gulp
[09:27:55] Failed to load external module #babel/register
[09:27:55] Failed to load external module babel-register
[09:27:55] Failed to load external module babel-core/register
[09:27:55] Failed to load external module babel/register
[09:27:55] Local gulp not found in ~/Documents/sites/test123
[09:27:55] Try running: npm install gulp
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! foundation-emails-template#1.0.0 start: `gulp`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the foundation-emails-template#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexcrisan/.npm/_logs/2018-12-26T14_27_55_973Z-debug.log
I follow the error code to install gulp, and get this:
Alexandrus-MacBook-Pro-2:test123 alexcrisan$ npm install gulp
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git checkout 4.0
npm ERR! error: pathspec '4.0' did not match any file(s) known to git.
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/alexcrisan/.npm/_logs/2018-12-26T15_03_01_008Z-debug.log
I found some similar answers online but couldn't find a straightforward way to solve this without digging myself into more confusion.
Running Mac OS Mojave (latest).
Thank you!
The git release name of gulp has changed from 4.0 to v4.0.0 which means that git cant find the node module to install it.
if you open your package.json and you should see something like:
"gulp": "github:gulpjs/gulp#4.0",
replace it with:
"gulp": "github:gulpjs/gulp#v4.0.0",
Then delete your node-modules folder and reinstall, it should run fine now.
I know how you feel, this had me confused for a while. To resolve it I looked at the released versions on github (https://github.com/gulpjs/gulp/releases) and used the v4.0.0 release in place of what was there.
I'm trying to deploy a Node.js app to elastic beanstalk. The problem is, it fails at the start script every time. I have ec2 configured to use the start script npm start, which executes node app.js (defined in package.json). However, this start script fails in ec2. I get the logged error,
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myProject start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the Portfolio package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs myProject
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls myProject
npm ERR! There is likely additional logging output above.
What does this mean? Running npm start on my command line in the root directory of the same app that was zipped to AWS works fine, running on localhost. I also have updated both npm and node.js
Here is the file structure zipped to deploy:
.zip
node_modules/
public/
app.js
package.json
package-lock.json
I faced a problem with similar symptoms on Elastic Beanstalk which was caused by missing npm dependencies. Some dependencies were installed locally in node_modules, but one or two we're installed globally, causing them not to be packaged when zipping for deployment. Unfortunately Elastic Beanstalk's error message is less than helpful in this case and gives a generic error.
Hey I've been trying to install "ws" module but when I run npm install ws it gives following error,
npm WARN enoent ENOENT:<Folder name> no such file or directory, open 'G:\Dead Simple\package.json'
Well I searched for solution , everybody answered it as you should have package.json file in your project directory but being a beginner I really don't what to write in that file.How should I resolve it ?
It gives me exactly this output ...
npm WARN enoent ENOENT: no such file or directory, open 'G:\Dead Simple\package.json'
npm WARN Dead Simple No description
npm WARN Dead Simple No repository field.
npm WARN Dead Simple No README data
npm WARN Dead Simple No license field.
You don't need to write anything. At the beginning of your project when you:
npm init
a package.json will be created, listing references to packages you have installed. Installing extra packages add them to your node_modules directory, and adds a reference to your package.json.