2 package.jsons


#1

Have to reinstall subdirectory node modules every day here this person said he can have 2 package.jsons 1 on app/ and one in a subdir but for me this doent work https://glitch.com/edit/#!/stuffystuff


#2

Hi @geoffrey1900, you don’t have the “install” script set up in your top-level package.json, as I mentioned in Have to reinstall subdirectory node modules every day, at least in the project you linked to. If you add that here it should start working.


#3

so what and where do i exsatly put in


#4

From here, you need this code (adjusted for your project’s layout, assuming I’m interpreting your needs correctly):

"install":"cd /app/b && pnpm install && cd /app"

After this line in your top-level package.json.


#5

ok thanks ill try that


#6
Check /app/package.json: it has syntax errors, install won't proceed.
parse error: Expected separator between values at line 5, column 11
Jump to

Check /app/package.json: it has syntax errors, install won't proceed.
parse error: Expected separator between values at line 6, column 11

uhhhhh… heres my code:

//  /app/pachage.json
{
  "name": "arras",
  "version": "1.0.0",
  "main": "server.js",
  "scripts": {
    "start": "node server"
  },
  "dependencies": {
    "google-closure-library": "^20190121.0.0",
    "ws": "^6.1.4",
    "node-fetch": "^2.3.0",
    "fs": "^0.0.2",
    "path": "^0.12.7"
  },
  "engines": {
    "node": "10.x"
  },
  "license": "GPL-3.0",
  "install":"cd /app/b && pnpm install && cd /app"
}

// /app/b/package.json
{
   "name":"arras",
   "version":"1.0.0",
   "main":"b/server.js",
   "scripts":{
      "start":"node server"
   },
   "dependencies":{
      "google-closure-library":"^20190121.0.0",
      "ws":"^6.1.4",
      "node-fetch":"^2.3.0",
      "fs":"^0.0.2",
      "path":"^0.12.7"
   },
   "engines":{
      "node":"10.x"
   },
   "license":"GPL-3.0"
}

MOD EDIT: formatting


#7

I believe you’ve got your install script in the wrong place. It needs to go after this line inside the scripts property.