Cannot find `@microsoft/office-js` under `node_modules`

216 views Asked by At

My node version is node/14.21.3. I would like to use https://www.npmjs.com/package/@microsoft/office-js in the project to avoid the Office.js has not fully loaded error when using CDN. I tried to start a reactjs project from the beginning by create-react-app try, and then yarn add @microsoft/office-js inside try. But there was still no @microsoft/office-js folder. Here is the current package.json:

{
  "name": "try",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@microsoft/office-js": "^1.1.88",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
2

There are 2 answers

7
DavidP On BEST ANSWER

I am on a Mac, and it is there:

enter image description here

Command line confirms: ls -la node_modules/@micro* (if your terminal does not support bash-completion, then you need to enter it with the asterisk "*" to list all partials)

If you are on another platform, try and confirm using command line, file explorer, or IDE.

The NPM docs also lists:

Installing the NPM package locally creates a set of static Office.js files in the node_modules@microsoft\office-js\dist folder of the directory where you ran the npm install command.

2
Ben Carp On

Gernally speaking there is a reason why node_modules is hidden - Its' folder organization should be an implementation detail. If you need to check a version perhaps yarn list --pattern <package_name> will do. Package managers might organize package differently depending on the package manager and the version (links, vendors etc.). If you need to look at the code of the package I'd recommend searching by file name, or by entering source code. Then after you found a folder of the package, it will be easy to access the folder as well.