I tried to install the npm package “tracked-built-ins”, and I ran into a problem, my project writes that such a module is not installed, although I installed it.
code:
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { TrackedArray } from 'tracked-built-ins';
import { action } from '@ember/object';
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
export default class PurchasesController extends Controller {
@tracked purchases = new TrackedArray();
@action
addPurchase() {
var pname = this.purchaseName;
var pprice = this.purchasePrice;
this.purchases.push({ id: getRandomInt(0, 99), name: pname, price: pprice });
console.log(this.purchases);
}
}
error:
Error while processing route: purchases Could not find module `tracked-built-ins` imported from `firecost/controllers/purchases` Error: Could not find module `tracked-built-ins` imported from `firecost/controllers/purchases`
at missingModule (http://localhost:4200/assets/vendor.js:259:11)
at findModule (http://localhost:4200/assets/vendor.js:270:7)
at Module.findDeps (http://localhost:4200/assets/vendor.js:180:24)
at findModule (http://localhost:4200/assets/vendor.js:274:11)
at requireModule (http://localhost:4200/assets/vendor.js:36:15)
at Class._extractDefaultExport (http://localhost:4200/assets/vendor.js:94439:20)
at Class.resolveOther (http://localhost:4200/assets/vendor.js:94099:32)
at Class.resolve (http://localhost:4200/assets/vendor.js:94162:25)
at resolve (http://localhost:4200/assets/vendor.js:1761:36)
at Registry.resolve (http://localhost:4200/assets/vendor.js:1374:21)
logError @ router.js:1232
error @ router.js:1169
triggerEvent @ router.js:1332
triggerEvent @ router.js:189
trigger @ router_js.js:488
transitionDidError @ router.js:211
(anonymous) @ router_js.js:286
invokeCallback @ rsvp.js:493
publish @ rsvp.js:476
publishRejection @ rsvp.js:412
(anonymous) @ rsvp.js:19
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
end @ backburner.js:710
_run @ backburner.js:1015
run @ backburner.js:754
run @ index.js:114
callback @ application.js:434
Uncaught Error: Could not find module `tracked-built-ins` imported from `firecost/controllers/purchases`
at missingModule (loader.js:247)
at findModule (loader.js:258)
at Module.findDeps (loader.js:168)
at findModule (loader.js:262)
at requireModule (loader.js:24)
at Class._extractDefaultExport (index.js:463)
at Class.resolveOther (index.js:123)
at Class.resolve (index.js:186)
at resolve (index.js:1100)
at Registry.resolve (index.js:713)