Can't build Ember.js app embedded in Rails app on Heroku - javascript

Trying to build Ember.js app embedded in Rails app on Heroku, but get this error:
Could not require 'ember-cli-build.js': Cannot find module 'ember-cli/lib/broccoli/ember-app'
Rail's package.json:
{
"name": "foo",
"license": "MIT",
"engines": {
"node": "9.5.0",
"yarn": "1.22.4"
},
"scripts": {
"build": "yarn global add ember-cli#2.9.0 --ignore-engines && yarn --cwd ember install --ignore-engines && yarn --cwd ember build"
}
}
Ember's package.json:
{
"name": "foo",
"version": "0.0.0",
"description": "foo",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
},
...
}
This Ember.js app as stand-alone, i.e. not being embedded in Rails app, is deployed on Heroku without errors.

I've found an answer by myself via inspecting the log of successful deployment of stand-alone Ember app. All that needs to be done is to run the following in terminal before deployment:
heroku config:set NPM_CONFIG_PRODUCTION=false

Related

Deploy to Vercel error (Error: Command "npm run build" exited with 127)

I'm using parcel-bundler for sass on my projects, I've always used npm start instead of npm run build and it has always worked for me. But this time, when I try to deploy my project on vercel, it failed and it says "Error: Command "npm run build" exited with 127"?
[19:25:23.101] Cloning github.com/sn-tin/odin-etch-a-sketch (Branch: main, Commit: e5ff000)
[19:25:23.584] Cloning completed: 482.734ms
[19:25:23.676] Installing build runtime...
[19:25:25.452] Build runtime installed: 1.775s
[19:25:26.373] No Build Cache available
[19:25:26.541] Installing dependencies...
[19:25:27.829]
[19:25:27.830] added 17 packages in 1s
[19:25:27.830]
[19:25:27.830] 2 packages are looking for funding
[19:25:27.830] run `npm fund` for details
[19:25:28.030] Detected `package-lock.json` generated by npm 7...
[19:25:28.031] Running "npm run build"
[19:25:28.305]
[19:25:28.306] > odin-eas#1.0.0 build
[19:25:28.306] > parcel build src/index.html
[19:25:28.306]
[19:25:28.322] Error: Command "npm run build" exited with 127
My package.json
{
"name": "odin-eas",
"version": "1.0.0",
"description": "",
"main": "index.js",
"target": {
"main": false
},
"scripts": {
"start": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.5.0",
"bundler": "^0.8.0",
"parcel": "^2.5.0",
"sass": "^1.51.0"
}
}

How to run an application in codesandbox with different subfolder for backend and frontend

I want to get a codesandbox for an app I am working on. How do I make the project work with two different subfolders named backend and frontend?
How can that be done?
I am sending for you my packages.json file content:
{
"name": "projeto_aplicado",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"concurrently": "^6.2.0"
},
"devDependencies": {},
"scripts": {
"server": "npm run server --prefix backend",
"start": "concurrently \"npm run server\" \"npm run client\" ",
"client": "npm start --prefix frontend"
},
"author": "",
"license": "ISC"
}
I am also sending the link for my web app: https://codesandbox.io/s/blissful-fire-jjnl5?file=/package.json:0-393
You can't do that on codesandbox without Express as far as I know, here's a relevant Github issue: https://github.com/codesandbox/codesandbox-client/issues/1519.
This is for now not really possible unless you just display an HTML page from express :(
I took the express example starter template and edited it to work with 2 separate folders like your requirement, here's the link: https://codesandbox.io/s/cool-worker-wj464?file=/backend/app.js
I just created and renamed a folder and changed the code to use the right directories.

NPM is not recognized as an internal/external command

My package.json file for the server folder I'm trying to start:
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon src/app.js --exec 'npm run lint && node'",
"lint": "./node_modules/.bin/eslint **/*.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"eslint": "^4.12.0",
"nodemon": "^1.12.1"
}
}
I do not know why it doesn't notice npm from the package.json start script when npm runs perfectly when it's not being executed through package.json.
Anyone know why? I'm trying to learn Full Stack development and I am confused on this error.
Edit: I'm running Windows 10.
Use double quotes in your script as single quotes won't recognize in Windows command line.
Change your start to:
"start": "nodemon src/app.js --exec \"npm run lint && node\"",

JSPM can't install (404 from github) BUT CAN install from npm

This is truly frustrating.
Package.json for a repo hosted on github as part of my organisation. I am trying to pull this in via jspm.
{
"name": "tf-modernizr",
"version": "1.0.0",
"description": "",
"main": "modernizr.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/tomorrowfinance/tf-modernizr.git"
},
"author": "Simon Douglas",
"license": "MIT",
"bugs": {
"url": "https://github.com/tomorrowfinance/tf-modernizr/issues"
},
"homepage": "https://github.com/tomorrowfinance/tf-modernizr#readme",
"directories": {}
}
npm install works fine (!!!)
running jspm install:
jspm install github:tomorrowfinance/tf-modernizr#master
or jspm install github:tomorrowfinance/tf-modernizr informs me there is a 404.
Looking up github:tomorrowfinance/tf-modernizr
Updating registry cache...
Downloading github:tomorrowfinance/tf-modernizr#master
warn Error on download for github:tomorrowfinance/tf-modernizr
Bad response code 404
err Error downloading github:tomorrowfinance/tf-modernizr.
The documentation here http://jspm.io/docs/getting-started.html doesn't help. The documentation here https://github.com/jspm/registry/wiki/Configuring-Packages-for-jspm is complex. What am I missing?
Since this is a private repository, you need to allow jspm to access it.
Simply configure access to github using: jspm registry config github

emberjs ember cli jade templates not compiling?

I am using ember-cli to setup my new emberjs application. While I was able to successfully install jade, it does not appear to be rendering .jade templates added to the /app directory?
Thoughts? Current package.json:
{
"name": "frontend",
"version": "0.0.0",
"private": true,
"directories": {
"doc": "doc",
"test": "test"
},
"scripts": {
"start": "ember server",
"build": "ember build",
"test": "ember test"
},
"repository": "https://github.com/stefanpenner/ember-cli",
"engines": {
"node": ">= 0.10.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"ember-cli": "0.0.28",
"originate": "0.1.5",
"broccoli-ember-hbs-template-compiler": "^1.5.0",
"loom-generators-ember-appkit": "^1.1.1",
"express": "^4.1.1",
"body-parser": "^1.2.0",
"glob": "^3.2.9",
"broccoli-sass": "^0.1.4",
"broccoli-csso": "^0.2.0",
"broccoli-jade": "^0.2.0"
}
}
There is a rather small template in the /app folder named error.jade with the following code:
doctype html
head
title
|Error!
body
p
strong
|Error!
When I run ember serve or ember build it never gets compiled. Everything else is the standard setup in ember cli. I ran npm install --save broccoli-jade to install it. Here is an example repo I setup for this issue embercli-emberjs-test. Ideally I would like to compile both handlebars and jade templates.
Thoughts? github issue
try running
bower install
in your app root. Some times the post-install routine does not execute automatically.

Categories

Resources