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.
Related
I just deployed a new create-react-app and still receiving this same error message. I installed MUI and am receiving a 'unable to resolve dependency tree'
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: eat-blended-web#0.1.0
npm ERR! Found: react#18.1.0
npm ERR! node_modules/react
npm ERR! react#"^18.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/rodriguezmedia/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/rodriguezmedia/.npm/_logs/2022-05-13T00_57_27_262Z-debug-0.log
rodriguezmedia#Frankies-MacBook-Air-2 eat-blended-web %
instead of using "npm install #material-ui/core",
just refer to "npm install #mui/material"
and for mui icons just install "npm install #mui/icons-material".
for more details just go to "https://www.npmjs.com/package/#mui/icons-material" this page.
The error is telling you that the package you're trying to install has react#"^16.8.0 || ^17.0.0" in its peer dependencies, but you're currently using react#18.1.0.
You can get around this and install your package by including --legacy-peer-deps at the end of your command. For example:
npm install #mui/material --legacy-peer-deps
Keep in mind that peer dependencies are modules that the package is designed to work with. Using this flag to proceed with the installation can cause unintended and sometimes breaking changes. Since React 18 is new, some packages have not been updated to specifically include it in their peer dependencies.
Updated package names: #material-ui/core -> #mui/material
See more detail here: https://mui.com/material-ui/migration/migration-v4/#replace-all-imports
Please try this command
npm install #mui/material --legacy-peer-deps
So when I try to run the action:
Run OfficeDev/teamsfx-cli-action#v1
I get the following error:
/usr/local/bin/npx teamsfx config set run-from GitHubAction
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/teamsfx - Not found
npm ERR! 404
npm ERR! 404 'teamsfx#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.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-11-25T13_27_07_216Z-debug.log
Install for [ 'teamsfx#latest' ] failed with code 1
Error: The process '/usr/local/bin/npx' failed with exit code 1
I'm not sure what I am missing here, the ci/cd script I'm using is the default actions as described here
The script I have is very simple so I'm probably just missing something obvious:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
AZURE_ACCOUNT_NAME: ${{secrets.AZURE_ACCOUNT_NAME}}
AZURE_ACCOUNT_PASSWORD: ${{secrets.AZURE_ACCOUNT_PASSWORD}}
AZURE_SUBSCRIPTION_ID: ${{secrets.AZURE_SUBSCRIPTION_ID}}
AZURE_TENANT_ID: ${{secrets.AZURE_TENANT_ID}}
M365_ACCOUNT_NAME: ${{secrets.M365_ACCOUNT_NAME}}
M365_ACCOUNT_PASSWORD: ${{secrets.M365_ACCOUNT_PASSWORD}}
M365_TENANT_ID: ${{secrets.M365_TENANT_ID}}
steps:
# Provision resources.
- uses: OfficeDev/teamsfx-cli-action#v1
with:
commands: provision
subscription: ${{env.AZURE_SUBSCRIPTION_ID}}
# Deploy the code.
- uses: OfficeDev/teamsfx-cli-action#v1
with:
commands: deploy
# Publish the Teams App.
- uses: OfficeDev/teamsfx-cli-action#v1
with:
commands: publish
You're missing the teamsfx-cli. See docs:
"devDependencies": { "#microsoft/teamsfx-cli": "^0.3.1" }
Once that's installed, the command npx teamsfx is going to work.
In terms of changes to your workflow, you probably want to checkout your project as a first step and then run an npm ci.
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 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.
I want to put my one of my own repositories as a dependency to a project I am working on. Right now I am using NPM link to do that.
Also, I'd like it to prompt me for my username and password instead of putting that
kind of data in my repository when I use npm install. How do I do that? It doesn't do that now.
I want the content of the repository to show up as their own folder
The problem is when I run npm install it gives me a bunch of error messages from NPM. So I've tried two things. First I tried cloning a public repo from github:
Public Repo Github
SO in package.json, I used the ssh like this:
"dependencies": {
"repo_name": "git#github.com:ownername/reponame.git#84876fa5aasf55fssfsfafsa"
},
^Note that data is fake. The # is a commit hash.
It gave me this error when I ran npm install:
Warning: Permanently added the RSA host key for IP address '$IPADDRESS' to the list of known hosts.
Permission denied (publickey)
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Code 128
Then I tried HTTPS, again with a commit hash:
"dependencies": {
"repo_name": "https://github.com/ownername/reponame.git#84876fa5aasf55fssfsfafsa"
},
It worked.....kind of. It seemed to install all the depencies from the repo in the link
but didn't clone the repo in the link to repo_name, it didn't seem to clone anything.
So I decided to try a different repo. One without any dependencies of its own. I used the HTTPS....
it didn't work.
I got these errors:
npm ERR! addLocal Could not install /tmp/npm-11929-4791330b/git-cache-2278328b/38b944c916c18cd4e004f07f2f476a4bb393ff8e
npm ERR! Linux 4.8.0-58-generic
npm ERR! argv "$nodepathname" "$npmpathname" "install"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.
Private Repository Bitbucket
When I try my private repository via ssh via provided bitbucket string (with a commit hash), it gives me similar error messages with the other repository, it tells me:
Please make sure you have the correct access rights
npm ERR! code 128
npm ERR! Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
It doesn't prompt me for a username or password.
Using https on the private repo (with a commit hash, similar as before) gives me a similar error without prompting me with any username:
remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.
npm ERR! code 128
You could use the postinstall hook to initiate the Git clone after npm install:
"scripts": {
"postinstall": "git clone ... node_modules/..."
}
There is no way for npm to prompt for a username or password. Its just not designed to work that way. There is a couple ways to make what your doing work.
1) generate a ssh key(if you haven't already) and add it to your bitbucket.
2) make the private package public(ie open source it)
3) pay for private npm packages and publish a private npm module.
4) make a public npm package if your making open source project. You can still use npm link to link the project to the secondary project to test the packages before publishing. The dependency will be linked based on your not the folder name.
Option 1 and 2 are generally not recommended though. Not using an npm package kind of defeats the purpose of using npm at all. You should try to avoid linking to github directly unless there are extenuating circumstances such as you needed to fork a no longer maintained project and change code.
If you are just trying to avoid paying for private npm modules, personally I would not bother separating out the applications logic into different packages.
Just to all kind of expound. Maybe you are trying to create a module and have never done so before so I will explain that as well. If you have a private or public application (not an npm module, and you are trying to create a public open source npm module and link to it.)
Lets say you have the two folders.
/git/my_application
/git/my_new_npm_module
and your new npm module has the package name "new-module" in package.json. In order to use that in your my_application app, you would need to enter that directory and run npm link on your npm module
cd /git/my_application
npm link ../my_new_npm_module
now within any node file in your my_application app, you can use require('new-module'); to access what is exported from your new npm module.
when your ready to make your package public you simply need to update the version tag in the new modules package.json and type
npm publish
After googling about the specific problem, I found the following link.
link