Wai Yan Hein
Wai Yan Hein

Reputation: 14791

Can't resolve 'promise/lib/es6-extensions.js' and 'promise/lib/rejection-tracking' when 'npm run'

I am taking over an existing project. Which is a web application project developed using Vue js. I am having problem with 'npm run dev'. Me and my friend are using the same laptop (Mac OSX) and we have the same node and npm versions (10.9.0 and 6.2.0). We both pull the code from the git repository, then we run "npm install". Then we run "npm run produciton" / "npm run dev". But the run command is working fine on my friend's machine and not throwing any error. But, I am getting this error.

 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

As to solve the problem, I run this command.

npm install --save promise/lib/es6-extensions.js promise/lib/rejection-tracking

Then I got this error.

npm ERR! code ENOLOCAL
npm ERR! Could not install from "promise/lib/es6-extensions.js" as it does not contain a package.json file.

What is wrong, we are using same OS having same versions and node and npm. Why is it working on his machine and not on mine.

This is my 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"
  }
}

How can I solve this issue? I spent the whole morning finding the solution. Not working out.

Upvotes: 3

Views: 2087

Answers (1)

Wai Yan Hein
Wai Yan Hein

Reputation: 14791

Try this

npm install promise --save-dev

Make sure you included --save-dev

Still does not work?

remove/delete the node_modules folder and then run

npm install

Upvotes: 3

Related Questions