#line/bot-sdk in azure not working - node.js

I create a web application in Azure.
And deploy from a repository in bitbucket.
but azure always give me this error
Error: Cannot find module '#line/bot-sdk'
package.json:
{
"name": "linebot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"#line/bot-sdk": "^2.0.0",
"body-parser": "^1.17.2",
"express": "^4.15.3",
"fs-extra": "^3.0.1"
},
"devDependencies": {},
"engines": {
"node": ">=6"
},
"scripts": {
"start": "node index.js"
},
"author": "",
"license": "ISC"
}

It looks like the "#line/bot-sdk" has not been installed properly. First, please make sure the package.josn is located in root folder of the Repository.
Once you push your code to bitbucket, Kudu will sync the repository to /site/wwwroot on Azure App Service and run npm install --production here by executing the deployment script.
:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd !NPM_CMD! install --production
IF !ERRORLEVEL! NEQ 0 goto error
popd
)
Finally, you may want to check dependencies whether or not they have been installed via App Service Editor (https://[YouAppName].scm.azurewebsites.net/dev/wwwroot/).

Related

Expressjs App on Vercel, not installing peer dependencies

I'm building a small expressjs app that I host on vercel. Testing the app locally works fine, but when deploying and running on vercel, the require stack fails on my serverless function.
This is what vercel tells me :
2023-02-03T14:41:20.325Z undefined ERROR Cannot find module 'ndarray-pixels'
Require stack:
- /var/task/node_modules/#gltf-transform/functions/dist/functions.js
- /var/task/_index.js
My package.json looks like this
{
"name": "test - app",
"version": "1.0.0",
"description": "",
"main": "_index.js",
"scripts": {
"start": "node --experimental-fetch _index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#gltf-transform/core": "^2.5.1",
"#gltf-transform/extensions": "^2.5.1",
"#gltf-transform/functions": "^2.5.1",
"cors": "^2.8.5",
"express": "^4.18.2",
"fetch": "^1.1.0",
"gl-matrix": "^3.4.3",
"ktx-parse": "^0.4.5",
"ndarray-pixels": "^1.0.0",
"node-fetch": "^2.6.9",
"three": "^0.148.0"
}
}
.
I've tried adding the build override on vercel, with no luck.
npm install --legacy-peer-deps
Any help or pointers are much appreciated
This problem can happen if you accidentally send the node_modules folder to the git remote repository. If it is the case, remove the node_modules folder, create a .gitignore file if it not exists and just write node_modules inside the gitignore file.
Now you can:
git rm -r --cached .
git add --all .
git commit -a -m "Versioning untracked files"
git push

Can not deploy nodejs to heroku via heroku-cli and github

I have an issue while deploy my nodejs Apps to Heroku. I tried to git push directly (heroku cli) and also tried from github deploy, but both of them failed. Here log i got:
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> Node.js app detected
jq: error (at <stdin>:19): Cannot index string with string "iojs"
! Push rejected, failed to compile Node.js app.
! Push failed
I tried to check maybe dev dependents was the culprit, then try to change dev dependents package and remove all node_modules filder which "may" cause failure, but after retry, I'm still faced this issue. Also I tried to change the engine from 17.x to 16.x but still persists.
Maybe someone can give me a clue?
Below package.json i have:
{
"name": "coupling",
"version": "1.0.0",
"engines": "17.x",
"description": "",
"main": "server.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#vercel/node": "^1.12.1",
"csv-parser": "^3.0.0",
"express": "4.17.2",
"ws": "^8.4.2"
}
}
Your engines section is invalid:
"engines": "17.x",
Its value should be an object, not a string. Try this instead:
"engines": {
"node": "17.x"
}

The command moved into a separate package: #webpack-cli/serve

I looked at and executed almost every single answer on this post:
The CLI moved into a separate package: webpack-cli
It has not helped.
Allow me to present my case:
So I have developed a container folder, a separate application where I ran npm init -y and then installed the following:
npm install html-webpack-plugin#4.5.0 nodemon webpack#5.3.2 webpack-cli#4.1.0 webpack-dev-server#3.11.0
Then I went into my package.json file and added the start script:
{
"name": "container",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack serve"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"html-webpack-plugin": "^4.5.0",
"nodemon": "^2.0.6",
"webpack": "^5.3.2",
"webpack-cli": "^4.1.0",
"webpack-dev-server": "^3.11.0"
}
}
When I go to terminal and run npm start, this is why I get every single time:
➜ container npm start
> container#1.0.0 start /Users/luiscortes/Projects/ecommRS/container
> webpack serve
[webpack-cli] The command moved into a separate package: #webpack-cli/serve
? Would you like to install #webpack-cli/serve? (That will run npm install -D #webpack-cli/serve) (Y/n) › true
And yes even if I choose Y or true and it runs its npm install -D #webpack-cli/serve, when I go back to running npm start it just gives me the same error over and over again.
Apparently, this is an issue with webpack-cli#4.1.0. I upgraded to webpack-cli#4.2.0 and now it works.

How to deploy nodejs code from local machine to google app engine

I have just started with nodejs and app engine. I am following the tutorial
https://cloud.google.com/nodejs/tutorials
1) I have created a project then cloned the nodejs-mvms-quickstart repository.
2) Opened Development/source code and opened the nodejs-mvms-quickstart/1-hello-world
3) and started the node server
npm start
This is working fine. Now I want to deploy my nodejs application from my local server without copying to github and cloning on the server.
For this I am using following command
gcloud app deploy
but this is showing following errors:
If this is your first deployment, this may take a while...done.
Beginning deployment of service [default]...
Building and pushing image for service [default]
WARNING: No node version specified. Please add your node version, see https://docs.npmjs.com/files/package.json#engines
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[C:\Users\Sunil Garg\AppData\Roaming\gcloud\logs\2017.05.07\20.38.59.221000.log]
.
Started cloud build [1cd2979e-527b-4d68-b430-31471534246e].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/1c
d2979e-527b-4d68-b430-31471534246e?project=help-coin
ERROR: gcloud crashed (error): [Errno 10054] An existing connection was forcibly
closed by the remote host
If you would like to report this issue,please run the following command:
gcloud feedback
To check gcloud for common problems,please run the following command:
gcloud info --run-diagnostics
Here is my package.json
{
"name": "myapp",
"version": "1.0.0",
"description": "myapp",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": ""
},
"author": "",
"license": "ISC",
"bugs": {
"url": ""
},
"homepage": "",
"dependencies": {
"body-parser": "^1.15.0",
"connect-timeout": "^1.8.0",
"express": "^4.13.4",
"generic-pool": "^2.4.2",
"multer": "^1.2.0",
"mysql": "^2.10.2",
"requestify": "^0.1.17"
}
}
What is the issue? Am I missing something?
Try adding the following 2 parameters to the package.json
Add the version of node your application is compatible with.
"engines": {
"node": "4.6.0"
}
since you're using npm start you might need this in the script parameter as well since npm start is calling command stated in start in script param, change app.js according your application, like node quickstart.js. Always make sure to specify the path if your package.json is in the root directory and the .js is in a sub directory as well.
"scripts": {
"start": "node app.js"
}

npm install is extremely slow

I have the following package.json file:
{
"name": "trainologic",
"version": "1.0.0",
"description": "",
"main": "main.js",
"dependencies": {
"child_process": "^1.0.2",
"http-server": "^0.9.0",
"open": "0.0.5"
},
"devDependencies": {
},
"scripts": {
"start": "node main.js"
},
"author": "",
"license": "ISC"
}
When I do "npm install" it takes very-very long time to download 3 dependencies.
My OS is Ubuntu 16, and my node version is v4.2.6.
My suggestion:
Re-set your registry by trying out this command below
npm config set registry http://registry.npmjs.org/ --global
This is because your connection might have issues with npm https connection. this could be as a result of connecting via a proxy.
You can also try to check your connection and connect directly instead of via a proxy.
NOTE: After settling the proxy issue, I advise you switch back to a secured registry
npm config set registry https://registry.npmjs.org/ --global

Resources