我要接管一个现有项目。这是使用Vue js开发的Web应用程序项目。我在使用'npm run dev'时遇到问题。我和我的朋友使用的是同一台笔记本电脑(Mac OSX),并且我们具有相同的节点和npm版本(10.9.0和6.2.0)。我们都从git存储库中提取代码,然后运行“ npm install”。然后我们运行“ npm run produciton” /“ npm run dev”。但是运行命令在我朋友的机器上运行正常,并且没有引发任何错误。但是,我收到此错误。
ERROR Failed to compile with 2 errors 12:00:30
These dependencies were not found:
* promise/lib/es6-extensions.js in ./src/app.js
* promise/lib/rejection-tracking in ./src/app.js
To install them, you can run: npm install --save promise/lib/es6-extensions.js promise/lib/rejection-tracking
Asset Size Chunks Chunk Names
/cabs-app.js 2.08 MB 0 [emitted] [big] /cabs-app
ERROR in ./src/app.js
Module not found: Error: Can't resolve 'promise/lib/es6-extensions.js' in '/Users/wai/Desktop/'
@ ./src/app.js 5:19-59
@ multi ./src/app.js
ERROR in ./src/app.js
Module not found: Error: Can't resolve 'promise/lib/rejection-tracking' in '/Users/wai/Desktop/'
@ ./src/app.js 4:2-43
@ multi ./src/app.js
successfully deleted mix-manifest.json
为解决该问题,我运行此命令。
npm install --save promise/lib/es6-extensions.js promise/lib/rejection-tracking
然后我收到此错误。
npm ERR! code ENOLOCAL
npm ERR! Could not install from "promise/lib/es6-extensions.js" as it does not contain a package.json file.
出什么问题了,我们使用的是相同版本且节点和npm相同的操作系统。为什么它在他的机器上而不是我的机器上工作?
这是我的package.json
{
"name": "xxx",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"hot": "NODE_ENV=development webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"production": "NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"cross-env": "^5.1.4",
"es6-promise": "^4.2.4",
"laravel-mix": "^2.1.10",
"lodash": "^4.17.5",
"moment": "^2.22.0",
"url-search-params": "^0.10.0",
"vue": "^2.5.16",
"vuex": "^3.0.1"
}
}
如何解决此问题?我整个上午都在寻找解决方案。无法解决问题。
答案 0 :(得分:1)
尝试
npm install promise --save-dev
确保您包括--save-dev
仍然无法正常工作吗?
删除/删除node_modules文件夹,然后运行
npm install