OfficeDev / generator-office

Yeoman generator for building Microsoft Office related projects.
https://www.npmjs.com/package/generator-office
MIT License
818 stars 207 forks source link

Error: Cannot find module 'ajv/dist/core' #739

Closed stefanofalasca closed 1 year ago

stefanofalasca commented 1 year ago

Prerequisites

Expected behavior

When I run npm start work

Current behavior

I am started to create a new office addin angular task pane project. When I run npm start, I am getting follow error: image

millerds commented 1 year ago

Is this behavior reproducible with a new project? Have you tried running 'npm install' in the project to correct it?

Yeoman generator runs 'npm install' at the end of the project generation, but for some reason occasionally the command fails for some reason (not specific to office add-in projects). In those cases, running it manually should fix it.

stefanofalasca commented 1 year ago

Yes, I created a new project like from documentation, I deleted node_modules folder, I ran npm install and then npm start. Very easy

millerds commented 1 year ago

Did that correct the problem or was is still there?

stefanofalasca commented 1 year ago

Problem still there.

stefanofalasca commented 1 year ago

Any Solutions ? See angular projects doesn't work

millerds commented 1 year ago

I just noticed that you are using node v18. I realize that has become the new LTS branch of node, but we have not been able to check our tooling and projects against that version yet. Do you have the same problem when using node v16 (and the corresponding version of npm)?

millerds commented 1 year ago

I just tried this with node 18 and it worked fine for me. What documentation are you following to create the project?

stefanofalasca commented 1 year ago

I solved using "office-addin-debugging": "^4.3.14",

DonkeyKongJr commented 1 year ago

Got the very same issue today. It neither works with Node.js v18.17.0 nor with office-addin-debugging": "^4.3.14"?!

> npm start   

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module 'ajv/dist/core'
Require stack:

Downgrading to Node v16.20.1 didn't fixed the problem either.

Update: Manually adding the package as dev dep fixed the problem here.

npm install --save-dev ajv

paule96 commented 9 months ago

We found the same problem. But we needed to do both fixes. So we changed office-addin-debugging to ^4.3.14 and we did run npm install --save-dev ajv

Now it works with node 18 too.

thanks to (@DanielHabenicht)

Davidihl commented 6 months ago

Working with node 20.10.0 using npm install --save-dev ajv solved the issue for me too

sandyeveliz commented 1 month ago

Working with node 20.10.0 using npm install --save-dev ajv solved the issue for me too

This fix my issue for node 20 too, thanks @Davidihl

Bilawal-muzaffar commented 1 month ago

npm install --save-dev ajv solved the problem