gpt4 book ai didi

javascript - 在新机器上启动 Ember 项目时出错 : Unexpected token import, define is not defined

转载 作者:行者123 更新时间:2023-11-30 15:22:48 25 4
gpt4 key购买 nike

我在两台计算机上都有现有的 Ember js 项目,但我在新计算机上安装时遇到问题。

我是这样安装的:

git clone <repository-url>
cd projectfolder
npm install
bower install
ember serve

它编译但在浏览器上我看到这样的错误:

event-factory.js:3 - Uncaught SyntaxError: Unexpected token import

application.js:1 - Uncaught ReferenceError: define is not defined

似乎是 babel 的一些错误。

我有这样的package.json

{
"name": "project",
"version": "2.0.0",
"description": "",
"private": true,
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember test"
},
"repository": {
"type": "git",
"url": "..."
},
"engines": {
"node": ">= 0.12.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"broccoli-asset-rev": "^2.4.5",
"ember-ajax": "2.4.1",
"ember-cli": "^2.10.0",
"ember-cli-app-version": "^2.0.0",
"ember-cli-babel": "^5.1.7",
"ember-cli-data-export": "0.1.26",
"ember-cli-dependency-checker": "^1.3.0",
"ember-cli-deploy": "*",
"ember-cli-deploy-build": "*",
"ember-cli-deploy-gzip": "*",
"ember-cli-deploy-revision-data": "*",
"ember-cli-deploy-s3": "*",
"ember-cli-deploy-ssh-index": "*",
"ember-cli-google-fonts": "1.13.0",
"ember-cli-htmlbars": "^1.0.10",
"ember-cli-htmlbars-inline-precompile": "^0.3.3",
"ember-cli-inject-live-reload": "^1.4.1",
"ember-cli-jshint": "^2.0.1",
"ember-cli-moment-shim": "1.2.0",
"ember-cli-pagination": "2.2.3",
"ember-cli-qunit": "^3.0.1",
"ember-cli-release": "0.2.9",
"ember-cli-sri": "^2.1.0",
"ember-cli-test-loader": "^1.1.0",
"ember-cli-uglify": "^1.2.0",
"ember-content-editable": "0.10.0",
"ember-data": "^2.10.0",
"ember-data-change-tracker": "0.5.5",
"ember-disable-proxy-controllers": "^1.0.1",
"ember-export-application-global": "^1.0.5",
"ember-load-initializers": "^0.5.1",
"ember-metrics": "0.8.1",
"ember-notify": "^5.2.0",
"ember-power-select": "1.0.0",
"ember-radio-button": "1.1.1",
"ember-resolver": "^2.0.3",
"ember-select-guru": "^1.1.2",
"ember-simple-auth": "1.1.0",
"ember-simple-auth-loopback": "1.1.0",
"ember-truth-helpers": "1.2.0",
"ember-welcome-page": "^1.0.3",
"loader.js": "^4.0.10",
"mock-socket": "^6.0.4"
},
"dependencies": {
"ember-cli": "^2.11.1",
"ember-cli-babel": "^5.2.4",
"ember-cli-deploy": "^1.0.0",
"ember-cli-deploy-gzip": "^0.2.4",
"ember-cli-deploy-revision-data": "^0.3.3",
"ember-cli-deploy-s3": "^0.4.0",
"ember-cli-inject-live-reload": "^1.6.1",
"ember-cli-qunit": "^3.1.1",
"ember-data": "^2.11.3",
"ember-websockets": "6.3.0",
"loader.js": "^4.2.2"
}
}

和 bower.json:

{
"name": "getprospect",
"dependencies": {
"ember": "v2.10.2",
"ember-cli-shims": "0.1.3",
"ember-cli-test-loader": "0.2.2",
"ember-qunit-notifications": "0.1.0",
"bootstrap": "^3.3.6",
"jquery-stupid-table": "^1.0.1",
"jquery-auto-grow-input": "*",
"file-saver": "*",
"js-xlsx": "~0.8.0",
"fullcalendar": "^2.7.1",
"moment": "^2.17.1",
"moment-timezone": "^0.5.11",
"ember-simple-auth": "^0.8.0",
"raven-js": "^3.2.1",
"urijs": "^1.18.8",
"socket.io-client": "^1.7.2"
}
}

我在几个月前成功安装了这个项目,但无法弄清楚为什么没有在这台机器上启动...感谢任何帮助。

最佳答案

您遇到的问题很可能是使用 ^ 作为您的依赖项。 ^(插入符号)所做的是在您进行全新安装时将您的依赖项升级到主要版本。例如,如果您对插件的依赖是 1.2.0 并且您使用了 ^1.2.0 并且有可用的新版本 1.3.0,你会得到这个新的主要版本。如果您使用 ~ (tilda) 而不是 ^,那么您将不会得到 1.3.0,而是 1.2.2 例如,如果可用。为了使用准确的版本,以便在执行干净的 npm install 时您的依赖项不会更改,您可以在依赖项定义中删除插入符和 tilda。

为了找出您的哪些依赖项已过时,您可以使用 npm outdated

关于javascript - 在新机器上启动 Ember 项目时出错 : Unexpected token import, define is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43442137/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com