I recently upgraded my app from Ember 1.3 to Ember 2.4.2. However after deploying it to my production environment with ember build --env production I noticed a couple of issues.
The first issue was that each script/stylesheet tag had a integrity attribute attached to it which made it impossible to load those resources. After some investigation I decided to just replace the value for those attributes to be empty. This allowed the app to download the resources but I then noticed an error in the console that said define is not defined on the minified website.js file that Ember creates. I'm unable to replicate this issue locally because the app runs fine. What steps can I additionally take to investigate this issue? Could this be related to some addon that I have installed, or maybe the SRI integrity attribute that I removed?
Edit: I just tried building and deploying a vanilla app with Ember (e.g. ember new testApp and ember build --env production and encountered the same issue. Is there an issue with Ember that I don't know about? I don't think it's my server since I'm able to render a plain index.html just fine.
I prefer to use the latest NodeJS (v5.8) and the latest npm.
You can update your npm with npm install -g npm.
The best way to install NodeJS
I guess, you have the latest ember-cli. You can update it if you are outside of your project:
$ cd ~
$ npm install -g ember-cli
I just cloned your repository.
$ git clone https://github.com/uioporqwerty/website.git
$ cd website
$ npm install && bower install
$ ember server
Got the following error:
➜ website git:(master) ember s
version: 2.4.2
The Broccoli Plugin: [ConfigLoader] failed with:
Error: Attempting to watch missing directory: config
at EventEmitter.Watcher_addWatchDir [as addWatchDir] (/Users/szines/projects/temp/website/node_modules/broccoli-sane-watcher/index.js:90:11)
at /Users/szines/projects/temp/website/node_modules/ember-cli-broccoli/lib/builder.js:95:35
...
Because of a couple of important files are missing from your ember-cli project, I just run ember init
$ ember init
During this process you see a question. You can check suggested changes with 'd', but it would just remove bootstrap and font-awesome, which is fine, because we will reinstall them with ember install.
[?] Overwrite bower.json? (Yndh) Y
Now we remove all the previous bower and npm package, temp folder and dist folder.
$ rm -rf bower_components node_modules tmp dist
$ npm install && bower install
Install ember-bootstrap and ember-font-awesome:
$ ember install ember-bootstrap
$ ember install ember-font-awesome
Launch the server:
$ ember server
Your app working like a charm. Open localhost:4200 in your browser.
You can build the production:
$ ember build --prod
And all the files will be in /dist folder.
Or run the production version with the server:
$ ember server --prod
Enjoy your new Ember! :)
Update:
You can use ember-cli-update for updating your Ember app:
$ npx ember-cli-update
$ npx ember-cli-update --run-codemods
Source: Update Ember.js app
Zoltan's answer was very helpful in being a part of the solution to my problem. After fixing my local website according to Zoltan's answer I noticed some issues.
First, there was the following error with Ember-Cli 2.4.2:
Could not find module ember-data/-private\system\references\record imported from ember-data/-private/system/references
This issue has been resolved in the master branch of the Github repo for ember-cli but it hasn't made its way to the npm repo. So what I did was uninstall ember-cli with npm remove -g ember-cli and then followed the development instructions on the github repo https://github.com/ember-cli/ember-cli. This fixed that issue.
Additionally, I noticed that my nginx server was not serving js and css files; I tested this by creating a index.html with test.css and test.js and noticed that the server wasn't dishing out those files. Instead of trying to find the issue I noticed my nginx was a bit out of date on my RPI, it was at version 1.6.x, so I thought this would be a good time to update it; I updated it to 1.9.7 by first removing the old version then running this script https://gist.github.com/MattWilcox/402e2e8aa2e1c132ee24. After that I had nginx 1.9.7 but I did somehow have apache2 installed which caused its own headaches with recognizing the default website so I removed it.
Finally, since my settings were overridden I restored /etc/nginx from an rsync backup I have of my pi by just copying over that directory.
Then boom, everything worked. It took a while but everything seems to be working great at https://www.uioporqwerty.com and the qualsys lab report is working fine too https://www.ssllabs.com/ssltest/analyze.html?d=www.uioporqwerty.com so all my settings carried over correctly :)
Glad to have Ember-Cli working correctly.
Related
I am using expo#43.0.3 (and expo-cli#5.0.3) to manage my react native project and I have to install an npm package from local source:
$ npm install /path/to/mypackage
In my package.json the package is successfully linked via
"dependencies": {
...
"myPackage": "file:../../mypackage",
...
}
I can also confirm the package works when installing to a new plain node project (same node version 14.8.2)
Now when I start expo via expo start and navigate to the app it does not throw any error but only a warning:
› Reloading apps
warn No apps connected. Sending "reload" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.
When using the package from registry everything builds, however.
I tried to use the private packages section form the expo docs, but they only describe how to use private packages from registry but not local.
Anything I'm missing here?
edit:
After resetting the expo network adapters it loads the bundle but it now says it can't find the package:
Unable to resolve module myPackage from /home/user/path/to/myPackage/file.js: myPackage could not be found within the project or in these directories:
node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
However, I'm not using watchman and I'm not using yarn and rmoving metro- folders from /tmp did not make a difference.
As it turned out in this issue on GitHub it can be solved via npm pack:
run npm pack inside of your library and then npm install path/to/the/packed/file.tgz from your project
Which worked fine for the setup I described in the question.
I installed ember-cli tools, When i tried to create a new application using ember new book-app i get the following error
installing app
......
create tests/unit/.gitkeep
create vendor/.gitkeep
Successfully initialized git.
Installed packages for tooling via npm.
Error creating new application. Removing generated directory `./book-app`
Package ember not found
Error: Package ember not found
at createError (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/util/createError.js:4:15)
at /usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/core/resolverFactory.js:206:23
at _fulfilled (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:796:13)
at /usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:604:44
at runSingle (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/ember-cli/node_modules/bower/lib/node_modules/q/q.js:125:13)
at nextTickCallbackWith0Args (node.js:419:9)
at process._tickCallback (node.js:348:13)
I am not sure what the problem is. I am using ember-cli 2.7.0
Since no answer was provided and I just ran in to this exact error. What worked for me was to reinstall bower.
npm rm -g bower
npm install bower -g
I had a running Ember program built using Ember-Cli 1.13.12 using Node 4.2.4. I tried to upgrade to Ember-Cli 2.3.0 running on Node 4.2.6. I followed the procedure outlined in: https://github.com/ember-cli/ember-cli/releases. After the upgrade, my program generated all sorts of errors. I spent an entire day trying to get the program to work but couldn't. So I decided to try reverting back to Ember-cli 1.13.12. I checked out the lastest working version of my program before the upgrade attempt using git. I did the following to revert back to Ember-cli 1.13.12:
npm uninstall -g ember-cli
npm cache clean
bower cache clean
npm install -g ember-cli#1.13.12
rm -rf node_modules bower_components dist tmp
npm install
bower install
But the system still doesn't work. 'Ember Server' works as expected. But when I go to localhost:4200 in my browser, I get two errors:
Uncaught Error: Assertion Failed: Ember Views require jQuery between 1.7 and 2.1
Uncaught Error: Could not find module `ember` imported from `tw/app`
Can someone please help me figure out what's going on?
I think you're being hit by the problem in this post.
You can probably fix the issue by upgrading to ember-cli 1.13.14, if not check bellow.
For reference, the fix (if you're not updating ember-cli) is (from this answer by Lawree)
This is a bug due to a new version of jQuery. For now you can change
the following line in your bower.json file. Then run bower install and
it should work.
"jquery": "^1.11.3", to
"jquery": "1.11.3",
I tried do install Ember.js v2.2 by following the official instructions: http://guides.emberjs.com/v2.2.0/getting-started/
installed Node.js and npm
installed Git
installed the Ember CLI via npm install -g ember-cli
Everything should be fine now.
But when I type ember -v to verify the Ember version, it says: 1.13.13
I did follow the 2.2 Instructions to the point, but I didn't get Ember.js 2.2 installed.
Any suggestions? I use Win 7.
For ember 2.2 + ember-data 2.3.1:
ember new <project> && cd <project>
Edit bower.json in your project root directory (you're there already if you followed the previous command):
Replace ember-cli-shims version number to 0.1.0
Replace ember version number to 2.2
Remove the ember-data dependency line
Add the following code just above the last }
,
"resolutions": {
"ember": "^2.2.0"
}
Edit package.json in your project root directory:
Replace ember-data version number to 2.3.1
Clean the caches, update the project dependencies and then restart ember:
npm cache clean && bower cache clean && npm install && bower install
ember serve
And you're done. Open your browser console and you should see debug messages with the 2.2 version of ember and 2.3.1 version of ember-data.
ember on the command line is actually invoking Ember-CLI, so ember -v will show you the version you have for Ember-CLI. When you do ember new <your project> to create a project then you can manually change the Ember and Ember Data dependency versions in bower.json and package.json. Make sure to update both files (for now at least) and rerun npm install and bower install in the project's root directory.
The Ember version set by default with ember-cli does not track the most recent version of Ember, but you can update to 2.x. See the changelog.
Ember itself you will interact with in the browser after running ember server and going to your localhost.
I'm working on a pull-request for ember-data, and I'd like to be able to test these changes in my ember-cli app.
It doesn't work to follow the directions for using canary here or here, as my fork does not get built my components.
I've tried referencing my fork and branch in packages.json as well as bower.json; then I get this error:
Path or pattern "bower_components/ember-data/ember-data.js" did not match any files
I can then build ember-data manually and copy the file to bower_components/ember-data/ember-data.js. However, I would like a streamlined way to use a fork of ember-data so I can use and test my pull-request without a lengthy install process.
Is there a better way?
Thanks!
You can use a symlink to your local version of a bower and/or npm dependency.
Go to your local (forked) version of ember-data and
npm link
bower link
This will make a global symlink to your local version.
Then go to where you're using the dependency and
npm link ember-data
bower link ember-data
This will make node_modules/ember-data and bower_components/ember-data a symlink to your local version.
See https://docs.npmjs.com/cli/link and http://bower.io/docs/api/#link for more details on how these work.
You are getting that error because you are trying to use the NPM package of ember-data with Bower, and Bower needs ember-data to be precompiled. You were correct to fork emberjs/data and reference your fork in package.json. Here is how I compiled my fork for bower:
In your forked repo, run npm install and npm run build:production to compile your fork in the dist directory.
Then fork the ember-data shim for bower: components/ember-data. Copy the following files from your ember-data fork's dist directory into the shim's directory:
bower.json
component.json
composer.json
ember-data.js
ember-data.js.map
ember-data.min.js
ember-data.prod.js
package.json
Edit the bower/package files if you want to add your own version tag. Commit the shim repo to a branch or master, and then reference that commit in your ember-cli app's bower.json file. Then run npm install and bower install in your ember-cli app.