Cannot start mflix-js with npm start

Hi, there is a problem on Ubuntu 16.04.6 with the following cmds.

user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$ npm i
Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/63/6f'ando/Dropbox/M220/mflix-js/node_mod

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/34/02'.0 extracted to /home/user/Dropb

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/8e/17'e/user/Dropbox/M220/mflix-js/nod

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/8e/81'/home/user/Dropbox/M220/mflix-js

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/8e/49'220/mflix-js/node_modules/.staging/

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/34/3d'20/mflix-js/node_modules/.staging/p

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/8e/2c'20/mflix-js/node_modules/.staging/y

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/63/f0'o/Dropbox/M220/mflix-js/node_module

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/34/a0'M220/mflix-js/node_modules/.staging

Unhandled rejection Error: EACCES: permission denied, mkdir '/home/user/.npm/_cacache/index-v5/63/cb'do/Dropbox/M220/mflix-js/node_modul

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2019-09-18T07_22_09_397Z-debug.log
user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$ npm i

> weak-napi@1.0.3 install /home/user/Dropbox/M220/mflix-js/node_modules/weak-napi
> node-gyp rebuild

make: Entering directory '/home/user/Dropbox/M220/mflix-js/node_modules/weak-napi/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/src/nothing.o
  AR(target) Release/obj.target/../node-addon-api/src/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/weakref/src/weakref.o
  SOLINK_MODULE(target) Release/obj.target/weakref.node
  COPY Release/weakref.node
make: Leaving directory '/home/user/Dropbox/M220/mflix-js/node_modules/weak-napi/build'

> husky@1.3.1 install /home/user/Dropbox/M220/mflix-js/node_modules/husky
> node husky install

husky > setting up git hooks
Can't find .git, skipping Git hooks installation.
Please check that you're in a cloned repository or run 'git init' to create an empty Git repository and reinstall husky.

> core-js@2.6.9 postinstall /home/user/Dropbox/M220/mflix-js/node_modules/babel-runtime/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@3.2.1 postinstall /home/user/Dropbox/M220/mflix-js/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> nodemon@1.19.1 postinstall /home/user/Dropbox/M220/mflix-js/node_modules/nodemon
> node bin/postinstall || exit 0

npm WARN server@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1492 packages from 1302 contributors in 25.93s
user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$ npm start 

> server@1.0.0 start /home/user/Dropbox/M220/mflix-js
> nodemon -L ./index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./index.js`
/home/user/Dropbox/M220/mflix-js/src/index.js:1
import app from "./server";
       ^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Module._compile (/home/user/Dropbox/M220/mflix-js/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.newLoader [as .js] (/home/user/Dropbox/M220/mflix-js/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/user/Dropbox/M220/mflix-js/index.js:4:28)
[nodemon] app crashed - waiting for file changes before starting...
^C     
user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$

HI @Sunanda_Samaddar_30067,

The main cause for this is user permission issue. Please check the below thread that I found :

Let me know if it helps.

Kanika

HI Kanika, appreciate your tip. That part is done, however after npm rebuild this shows up.

user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$ npm start 

> server@1.0.0 start /home/user/Dropbox/M220/mflix-js
> nodemon -L ./index.js

[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./index.js`
/home/user/Dropbox/M220/mflix-js/src/index.js:1
import app from "./server";
       ^^^

SyntaxError: Unexpected identifier
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Module._compile (/home/user/Dropbox/M220/mflix-js/node_modules/pirates/lib/index.js:99:24)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.newLoader [as .js] (/home/user/Dropbox/M220/mflix-js/node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/user/Dropbox/M220/mflix-js/index.js:4:28)
[nodemon] app crashed - waiting for file changes before starting...
^C     
user@xxxxxxxxxxxx:~/Dropbox/M220/mflix-js$

Hi @Sunanda_Samaddar_30067,

Thanks for sharing this information.

Which version of node are you using right now?

I have 12.4.0 version. You can find yours by running node --version command from your command line.

Kanika

node is at v10.16.3.

Can you please upgrade it to the latest version?

Kanika

Thanks for helping Kanika. I should point out that import is unsupported in v10.*, see here for more.

Does that mean your application is working? :slight_smile:

Unfortunately, no. I suppose there’s still some syntax problem with src/index.js.

Hi @Sunanda_Samaddar_30067,

Please check if you have .babelrc file in your directory. Run ls .babelrc from mflix-js directory where all your files are present.

Kanika

I don’t have .babelrc, what kind of config should I use?

What happens when you run npm install ?

Kanika

npm WARN eslint-config-react-app@2.1.0 requires a peer of babel-eslint@^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@2.1.0 requires a peer of eslint-plugin-jsx-a11y@^5.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN server@1.0.0 No repository field.

audited 837559 packages in 13.157s
found 0 vulnerabilities

Hi @Sunanda_Samaddar_30067,

Sorry, it was in the Handouts from the course, please download it again: m220/mflix-js.zip.

Sometimes, when we copy/paste the unzipped files, hidden files starting with . does not get copy.

Kanika

1 Like

Yes, you’re right there. Thanks, it is running now!!

1 Like